randu 0.9.3

RANDU MCG65539 is IBM System/360 random number generator
Documentation

RANDU

Crates.io License Crates.io Version Crates.io MSRV Safe Rust dependency status Documentation Downloads

RANDU is Pseudorandom multiplicative congruential generator (MCG) used during 1960's and 1970's in the IBM Scientific Subroutine Library for IBM System/360 computers.

RANDU uses MCG coeficients multiplier a = 65539 ( 216 + 3 ) and modulus m = 231. It can be implemented very quickly on 32-bit hardware in just 2 operations: wrapping multiplication by a and bit masking of result using AND 0x7fffffff.

Generated values are non negative 31 bit integers. Generator period is 2^29. Lower bits have low randomness and should not be used separately. Problem with lower bits randomness is common for all congruential generators with power of 2 modulus.

RANDU fails the spectral test for dimensions greater than 2. RANDU produces very strong banding when used in 3 dimensions. All points in 3d space fall in 15 two-dimensional planes. This effect can be used in GPU programming for visual effects and take advantage of compute simplicity.

References

https://en.wikipedia.org/wiki/RANDU

https://oeis.org/A096555

https://en.wikipedia.org/wiki/Linear_congruential_generator

License

This is free and unencumbered software released into the public domain.

This code can be used under terms of CC0 or the Unlicense.

Unlicense logo