Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add reproducibility test for Mt::new_with_key #145

Merged
merged 1 commit into from
Jun 26, 2022

Conversation

lopopolo
Copy link
Member

No description provided.

@lopopolo lopopolo added the A-ruby Area: Compatibility with Ruby's Mersenne Twister implementation in `Random`. label Jun 26, 2022
lopopolo added a commit to artichoke/artichoke that referenced this pull request Jun 26, 2022
MRI uses an `init_by_array` [0] function to initialize a `Random`
instance with an arbitrarily-wide `Bignum` seed.

[0] https://github.com/ruby/ruby/blob/v2_6_3/random.c#L373-L402

This requires exposing `Mt::new_with_key` from `rand_mt`. This patch
makes a breaking change to `Random::with_array_seed` so that it accepts
an `IntoIterator<Item = u32>`.

Because `spinoso-random` can now have arbitarily wide keys, it stores
the seed in a `Vec`, which means the crate now requires `alloc`.

This patch does the minimum to get `artichoke-backend` working with
these changes.

Bump spinoso-random to 0.3.0.

These changes match these from upstream `rand_mt`:

- artichoke/rand_mt#145
@lopopolo lopopolo merged commit 2c2123f into trunk Jun 26, 2022
@lopopolo lopopolo deleted the lopopolo/reproducibility-test-new-with-key branch June 26, 2022 16:00
@lopopolo lopopolo mentioned this pull request Jul 31, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-ruby Area: Compatibility with Ruby's Mersenne Twister implementation in `Random`.
Development

Successfully merging this pull request may close these issues.

1 participant