[fpc-pascal] 32-bit random numbers

Mark Morgan Lloyd markMLl.fpc-pascal at telemetry.co.uk
Fri Apr 21 11:11:53 CEST 2017


Am I correct in interpreting the documentation as implying that if I 
want to get a full-range 32-bit unsigned random number I have to use 
something like Random($100000000) ?

Internally, that gets a 64-bit random by calling genrand_MT19937 twice 
and throwing away one of the results. Not only does that waste time, but 
it also means that if I use a "well known" seed I only see every other 
value from the expected sequence e.g. http://oeis.org/A221557

-- 
Mark Morgan Lloyd
markMLl .AT. telemetry.co .DOT. uk

[Opinions above are the author's, not those of his employers or colleagues]



More information about the fpc-pascal mailing list