Split Mersenne-Twister states between rand() and rand(N>382) #6573
Labels
bug
Indicates an unexpected problem or unintended behavior
priority
This should be addressed urgently
randomness
Random number generation and the Random stdlib
Milestone
As reported on the dev mailing list, there's some sort of DSFMT state corruption after generating
odd-lengtharrays with more than 382 elements:It looks (to my novice eyes) like
rand()
(which punts to an implementation in dsfmt.h:266) andrand(n)
(implemented in dsfmt.c:182) end up with independent DSFMT states.I'm not sure how or why, but it only seems to get triggered after callingrand(N)
with odd N > 382... which is a very specific branch in librandom.jl:120.Edit: It seems to be much more general than what I stated above. I think
rand()
andrand(N)
are living completely split lives with separate states; N need not be odd to trigger the bug. All that is required is that there's a call torand()
before doing the array generation (In the initial report, it was repeating calls of rand(N) with N odd — which satisfies the call to rand()).The text was updated successfully, but these errors were encountered: