Nonuniform PRNG?
Sabrina Almodóvar
salmodovar at ligumu.com
Wed Dec 7 13:28:47 EST 2022
On 07/12/2022 14:04, Stefan Ram wrote:
> ram at zedat.fu-berlin.de (Stefan Ram) writes:
>> So, in this case, careful code reviews might be better than
>> tests. For example, assuming, random.intrange( 0, 2 ) works
>> as advertised, we can be pretty sure that
>> 0 if random.randint( 0, 2 ) else 1
>> fulfills the requirement.
>
> In practice, tests should still be done. When such a function
> returns the same result a hundred times, it does make sense
> to become suspicious and investigate it.
Whatever it does a hundred times is not enough. Code review is
definitely not enough. The design of PRNGs should be good in theory ---
designed with good mathematical foundations --- and in practice by
passing all tests in the best-designed batteries. As far as I know, the
state-of-the-art in statistical tests against PRNGs is the TestU01
library, available at
http://simul.iro.umontreal.ca/testu01/tu01.html
More information about the Python-list
mailing list