math.random.xos - Xorshift random number generator ¶This module implements one of xorshift-family pseudo random generator (in the current implementation, we use Xoshiro256++). It has smaller state size than Mersenne-Twister.
{math.random.xos}
A class to packate the state of Xoshiro256 PRNG (the name stands for
Xor-Shift-Rotate 256bits).
{math.random.xos}
Creates and returns a new <xos-random> PRNG instance.
An optional seed argument must be a u64 integer if given, providing
a random seed. We process this sheed with split-mix 64 to fill the state,
so any seed value is valid. When omitted, a fixed seed value is used.
By default, access to the PRNG is mutexed. If you know there’s only one thread accessing it, you can pass a true value to private? to avoid the overhead.
{math.random.xos}
Returns a new <xos-random> PRNG instance that copies
the state of the source xos. Both source and created PRNG
will produce the same random sequence. This can be used to take
‘snapshot‘ of the PRNG state.
The private-ness (not mutexing PRNG) is not automatically passed to the new instance. To make the new instance mutex-less, pass a true value to The keyword argument private?.
{math.random.xos}
Copies src-xos’s PRNG state over dst-xos’s PRNG state.
Previous state of dst-xos is destoryed, and both xos PRNG
will produce the same random sequence afterwards.
The private-ness of dst-xos is kept as is; it is not a part of the PRNG state.
This can be used to “restore” previously saved PRNG state.
{math.random.xos}
Compare to xos PRNGs’ states. If this returns #t, both
PRNGs will produce the same random sequence.
The private-ness of xos1 and xos2 are not compared.
{math.random.xos}
Returns the seed value (u64 integer) used to initialize xos.
{math.random.xos}
Set the seed value (u64 integer) to the PRNG xos, and reinitialize it.
{math.random.xos}