JuliaRandom / RandomNumbers.jl

Random Number Generators for the Julia Language.
https://juliarandom.github.io/RandomNumbers.jl/stable
Other
97 stars 23 forks source link

Wrong implementation of Mersenne Twister #57

Closed gyk closed 5 years ago

gyk commented 5 years ago

These two lines of tempering transform should use left shift: https://github.com/sunoru/RandomNumbers.jl/blob/v1.2.0/src/MersenneTwisters/bases.jl#L77-L78.

As a verification, when seeded with 5489, MT19937 generates a UInt32 sequence of 0xD091BB5C, 0x22AE9EF6, 0xE7E1FAEE, ....

sunoru commented 5 years ago

OMG, you are right!

It was a terribly wrong implementation. I wonder why it could pass the empirical tests...

sunoru commented 5 years ago

Fixed.