Next: , Previous: , Up: random generators   [Index]

49.8.4 Borosh generator

This generator is called Borosh–Niederreiter. It was taken from:

Donald E. Knuth. “The Art of Computer Programming”. Volume 2. Third Edition. Addison-Wesley. Page 106-108.

the following bindings are exported by the (vicare crypto randomisations borosh) library.

Function: make-random-source/borosh

Build and return a new randomness source using the Borosh–Niederreiter generator.

The state returned by random-source-state-ref is a Scheme vector of length 2, whose first value is the symbol random-source-state/borosh. The other value is a single integer representable with 32 bits.

The random-source-seed! function for this generator, must be applied to a numbers maker returning integers representable with 32 bits.

The algorithm

The generator computes a new integer N' from an initial state N with the following formulation:

M = 2^32
A = 1812433253

N' = (A * N) mod M

(vicare crypto randomisations borosh) sets the initial state to N = 1.