-
Notifications
You must be signed in to change notification settings - Fork 99
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
At least in pcg32 first number of stream is always the same #85
Comments
You nailed it. Note, however, that the two generators in your example both use the same seed. Rather than using different seeds to generate different sequences, you are using identical seeds, but different streams. A sounder approach would be to use different seeds and different streams. Three obvious workarounds occur to me.
To accomplish number 3, note that the definition for type alias
Using these as our guide, we can create a new type alias for PCG engine
Here is the test routine I ran:
And here is the output. Although this test uses the same seed for both engines, in practice, I would use a different seed in each engine.
|
The apparent reason is that when the engines
output_previous
template parameter is true, the previous internal state generated with the previous increment is returned first. This is at least unintuitive, and I'd even consider it a bug. Maybeset_stream
should bump the internal state whenoutput_previous
is true (though I have to admit I don't really see the purpose of outputting the previous state in any case, but I'm sure I'm just missing something?).Example code:
Also, if I use stream numbers 1 and 2, or for example 73, 146 or such simply generated seeds, the first two numbers generated are identical, but I suppose that's what's described shortly in https://www.pcg-random.org/posts/critiquing-pcg-streams.html in the STOP PRESS parentheses statement. I'd be more than happy to read a slightly longer discussion of how to safely initialize a number of streams, initially just given consecutive integers as instance numbers?
The text was updated successfully, but these errors were encountered: