Commit graph

2 commits

Author SHA1 Message Date
Bill Currie
91a686d1f5 [util] Add mtwist float random number functions
mtwist_rand_0_1 produces numbers in the range [0, 1) and
mtwist_rand_m1_1 produces numbers in the range (-1, 1). The numbers will
not be denormal, so the distribution should be fairly uniform (as much
as Mersenne Twister itself is), but this needs proper testing.

0 is included for the mtwist_rand_0_1 as it seems useful, but -1 is not
included in mtwist_rand_m1_1 in order to keep the extremes of the
distribution balanced around 0.
2021-12-24 06:45:13 +09:00
Bill Currie
5188644e75 Implement the Mersenne Twister PRNG.
This gives QF a consistent qualilty PRNG on all platforms. The
implementation is slightly different from the standard, but gives the same
results for the same speed (details in mersenne.c).
2013-01-21 20:05:16 +09:00