-
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
MCG initialisation #45
Comments
As this issue comes up from time to time, I'm going to risk a bit of futility by reviving an old topic. Apologies to @dhardy if he already knows the things I've written here. The reason that PCG masks the two low-order bits of MCG state is because they never change. Setting them to a prescribed value makes them predictable. You should test this yourself by writing a program that gets access to the internal state. The trick is to use When I did this, I learned that the two low-order bits never change. During seeding, it does not matter what mask you use. Whatever values you set for the two LSBs, you'll be stuck with them. Random number generation does not modify them. In the C++ implementation, they are both set to 1 (i.e., I don't know much about the C implementation, but I believe it does not have a So, what about the sequences generated by PCG? Given identical seeds, and four different engines that set the bits to 00, 01, 10, and 11, would the four engines produce identical output? The obvious answer is that depends how those bits are used by the permutation function. If they are used in any way at all, then the sequences would probably be different. Does that affect the quality of the generated numbers? Hopefully not, but I am not qualified to answer the question. Presumably, Melissa O'Neill has chosen permutations where the answer is no. Let us know if you find anything more... |
I notice that the C++ code forces two bits high:
while the C code only forces one bit high:
Is there a reason these two are not equivalent?
I also notice that this variant is missing from the C++ test suite (although since it is only ever initialised to 42 in the suite, no one would notice this difference).
The text was updated successfully, but these errors were encountered: