Hi all,
I would like to know if there is a way to directly access the prng-state of the mersenne-twister (current PRNG used in FPC iiuc)?
Background:
1 - I would like to retrieve the lowest 128-256 bit, after a call to Random(), consider them as a fractional and then do an upward multiplication with a 128 bit integer to generate a range restricted 128 bit integer random.
2 - currently I have to do this by first generating a 128 bit random integer (via 4 individual calls to Random( $100000000 )) and then do a downward modulo reduction to the required range.
Solution 2 has some disadvantages, as it requires substantially more time and, via the downward modulo, I am loosing the uniform distribution qualities of the Mersenne Twister (if my math serves me right).
Regards,
MathMan