Crate xorwowgen

Source
Expand description

Several implementations of the xorwow algorithm described here: http://www.jstatsoft.org/v08/i14/paper. The last element of the underlying u32 array is used as the counter for the so-called Weyl sequence. xorwowgen::Xorwow160 comes closest to the ‘xorwow’ function described in the paper. All other implementations are derivative.

§Example

use rand_core::{SeedableRng, RngCore};
use xorwowgen::Xorwow160;

// initialize the generator
let mut rng = Xorwow160::seed_from_u64(1234);

// clock it a few times
for _ in 0..100 {
    rng.next_u32();
}

assert_eq!(2581263997, rng.next_u32());

§Features

§serde1

Allows (de)serialization of the state array using serde.

Modules§

xorwow64
Very fast Xorwow derivatives. Consist of a single 64 bit state and a modulo 2^64 counter.
xorwow128
Xorwow derivatives with 2 * 64 = 128 bits of state and a modulo 2^64 counter.

Structs§

Xorwow96
Xorwow implementation with 96 bits of state plus 32 bits for the modulo 2^32 counter.
Xorwow128
Xorwow implementation with 128 bits of state plus 32 bits for the modulo 2^32 counter.
Xorwow160
Xorwow implementation with 160 bits of state plus 32 bits for the modulo 2^32 counter.
XorwowXor96
Xorwow implementation with a footprint of 96 bits plus 32 bits of counter. Uses bitxor instead of wrapping_add for combining the regular Xorshift with the Weyl sequence.
XorwowXor128
Xorwow implementation with a footprint of 128 bits plus 32 bits of counter. Uses bitxor instead of wrapping_add for combining the regular Xorshift with the Weyl sequence.
XorwowXor160
Xorwow implementation with a footprint of 160 bits plus 32 bits of counter. Uses bitxor instead of wrapping_add for combining the regular Xorshift with the Weyl sequence.