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

simplify seeding for Xoshiro/TaskLocalRNG/GLOBAL_RNG #41106

Merged
merged 1 commit into from
Jun 11, 2021
Merged

Conversation

rfourquet
Copy link
Member

@rfourquet rfourquet commented Jun 6, 2021

  1. seed!(rng::Xoshiro, seed::NTuple{4,UInt64}) and
    seed!(rng::TaskLocalRNG, seed::NTuple{4,UInt64}) were doing almost the same thing;
    factor out what was identical;
  2. seed!(rng::Union{TaskLocalRNG, Xoshiro}) was calling the above methods passing
    a random tuple generated by RandomDevice: in this case, we don't really need
    to hash the seed, as it's presumably random enough; so use the same algorithm
    as in Xoshiro() constructor, and let Xoshiro() re-use this new implementation
    of seed!.

@rfourquet rfourquet added randomness Random number generation and the Random stdlib DO NOT MERGE Do not merge this PR! labels Jun 6, 2021
Base automatically changed from rf/xoshiro-constructor to master June 7, 2021 17:03
@rfourquet rfourquet removed the DO NOT MERGE Do not merge this PR! label Jun 8, 2021
1. `seed!(rng::Xoshiro, seed::NTuple{4,UInt64})` and
   `seed!(rng::TaskLocalRNG, seed::NTuple{4,UInt64})` were doing almost the same thing;
   factor out what was identical;
2. `seed!(rng::Union{TaskLocalRNG, Xoshiro})` was calling the above methods passing
   a random tuple generated by `RandomDevice`: in this case, we don't really need
   to hash the seed, as it's presumably random enough; so use the same algorithm
   as in `Xoshiro()` constructor, and let `Xoshiro()` re-use this new implementation
   of `seed!`.
@rfourquet rfourquet merged commit e35028a into master Jun 11, 2021
@rfourquet rfourquet deleted the rf/xoshiro-seed branch June 11, 2021 09:48
KristofferC pushed a commit that referenced this pull request Jun 17, 2021
1. `seed!(rng::Xoshiro, seed::NTuple{4,UInt64})` and
   `seed!(rng::TaskLocalRNG, seed::NTuple{4,UInt64})` were doing almost the same thing;
   factor out what was identical;
2. `seed!(rng::Union{TaskLocalRNG, Xoshiro})` was calling the above methods passing
   a random tuple generated by `RandomDevice`: in this case, we don't really need
   to hash the seed, as it's presumably random enough; so use the same algorithm
   as in `Xoshiro()` constructor, and let `Xoshiro()` re-use this new implementation
   of `seed!`.

(cherry picked from commit e35028a)
@KristofferC KristofferC mentioned this pull request Jun 17, 2021
20 tasks
johanmon pushed a commit to johanmon/julia that referenced this pull request Jul 5, 2021
1. `seed!(rng::Xoshiro, seed::NTuple{4,UInt64})` and
   `seed!(rng::TaskLocalRNG, seed::NTuple{4,UInt64})` were doing almost the same thing;
   factor out what was identical;
2. `seed!(rng::Union{TaskLocalRNG, Xoshiro})` was calling the above methods passing
   a random tuple generated by `RandomDevice`: in this case, we don't really need
   to hash the seed, as it's presumably random enough; so use the same algorithm
   as in `Xoshiro()` constructor, and let `Xoshiro()` re-use this new implementation
   of `seed!`.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
randomness Random number generation and the Random stdlib
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants