You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
MixMax RNG with variate_generator returns constant values when initialised with seed = 0 #104
@kotika Does a check need to be added to ensure the user gives a non-zero seed? We could throw std::range_error saying the value has to be [1, UINT32/64_MAX]
For the purposes of generating pseudo-random numbers with this method, one chooses the initial vector u(0), called the “seed”, with at least one non-zero component
(emphasis mine), which seems to imply any restriction should just be on the full four-argument form. The uint64_t overload could be made to never have an invalid value if at least one of the two other arguments were nonzero, I believe.
My question is if the statement "random numbers are statistically independent from any two distinct seeds, e.g. consecutive seeds are ok" remains true in this case.
The seeding method has been significantly improved since the time ROOT and FORTRAN versions were produced.
In the new version which boost ships, the all-zero seed results a non-zero initial vector as required. Specifically it results in the unit initial vector:
{1,0,0,...0}. The random numbers produced from this initial vector are just as good as from any other seed, but it needs to warm up - just in that special case. Spit out approx 72 values, and after that it is just fine.
Activity
mborland commentedon May 17, 2024
@kotika Does a check need to be added to ensure the user gives a non-zero seed? We could throw
std::range_errorsaying the value has to be [1, UINT32/64_MAX]WardBrian commentedon May 17, 2024
This seems to be the case only when the 4-argument version is called with all zeros. If the line
random/include/boost/random/mixmax.hpp
Lines 183 to 184 in 0190232
was updated to e.g.
seed_uniquestream( &S, 0, 1, (uint32_t)(seedval>>32), (uint32_t)seedval );Then the issue appears to go away
https://arxiv.org/pdf/1403.5355 includes the line
(emphasis mine), which seems to imply any restriction should just be on the full four-argument form. The uint64_t overload could be made to never have an invalid value if at least one of the two other arguments were nonzero, I believe.
My question is if the statement "
random numbers are statistically independent from any two distinct seeds, e.g. consecutive seeds are ok" remains true in this case.Several other implementations do seem to trap the seed being 0:
https://github.com/ramos/mxmx/blob/master/src/mixmax.f90#L180-L181
https://root.cern/doc/master/mixmax_8icc_source.html#l00212
kotika commentedon Jan 30, 2025
The seeding method has been significantly improved since the time ROOT and FORTRAN versions were produced.
In the new version which boost ships, the all-zero seed results a non-zero initial vector as required. Specifically it results in the unit initial vector:
{1,0,0,...0}. The random numbers produced from this initial vector are just as good as from any other seed, but it needs to warm up - just in that special case. Spit out approx 72 values, and after that it is just fine.