Expand description
Mean, lean, fast generation of random numbers of various types. Also filling vectors and vectors of vectors with random numbers
Re-exports§
Modules§
- error
- Custom error RError
Functions§
- get_
seed - For saving the current value of seed, reproducing the same sequence later
- ran_f64
- Possibly the best generator of f64 in the standardized range [0,1). Based on: `xoshiro256+1.0`` algorithm by David Blackman and Sebastiano Vigna (vigna@acm.org), 2018.
- ran_
f64_ range - Generate an f64 random number in the RangeInclusive min..=max
- ran_
fast_ f64 - Generates an f64 random number in the standardized range [0,1).
It can be linearly transformed to any [min,max] range.
Very fast, using just three shift and XOR instructions. Based on: George Marsaglia, Xorshift RNGs, Journal of Statistical Software 08(i14), Jan 2003. - ran_i64
- i64 random number by simple casting
- ran_
i64_ range - Generate an i64 random number in the RangeInclusive min..=max, where the range may span zero.
- ran_u8
- Generates an u8 random number in [0,255].
- ran_u16
- Generates an u16 random number in [0,65535]. We can similarly recast u64 to any other (narrower) type.
- ran_u64
- Possibly the best 64 bits random generator, based on XOR and shift.
Adapted from
xoshiro256** 1.0
algorithm by David Blackman and Sebastiano Vigna (vigna@acm.org), 2018. - ran_
u64_ range - Generate an u64 random number in the RangeInclusive min..=max
- ran_
ubits - Get random numbers of various smaller unsigned integer types by specifying the number of bits required.
- ranv_
f64 - Generates vector of size d, of f64 random numbers in [0,1).
- ranv_
f64_ range - Generates vector of size d, of f64 random numbers in the RangeInclusive min..=max.
- ranv_
i64 - Generates vector of size d, of i64 random numbers.
- ranv_
i64_ range - Generates vector of size d, of i64 random numbers in the RangeInclusive min..=max. May include zero.
- ranv_u8
- Generates vector of size d, of u8 random numbers in [0,255].
- ranv_
u16 - Generates vector of size d, of u16 random numbers in [0,65535]. We can similarly recast u64 to any other (narrower) type.
- ranv_
u64 - Generates vector of size d, filled with full range u64 random numbers.
- ranv_
u64_ range - Generates vector of size d, of u64 random numbers in the RangeInclusive min..=max
- ranvv_
f64 - Generates n vectors of size d each, of f64 random numbers in [0,1), using the xor-shift algorithm.
- ranvv_
f64_ range - Generates n vectors of size d, of f64 random numbers in the RangeInclusive min..=max.
- ranvv_
i64 - Generates n vectors of size d each, of i64 random numbers.
- ranvv_
i64_ range - Generates n vectors of size d, of i64 random numbers in the RangeInclusive min..=max. May include zero.
- ranvv_
u8 - Generates n vectors of size d each, of u8 random numbers in the interval [0,255].
- ranvv_
u16 - Generates n vectors of size d each, of u16 random numbers in the interval [0,65535].
- ranvv_
u64 - Generates n vectors of size d each, of full range u64 random numbers.
- ranvv_
u64_ range - Generates n vectors of size d, of u64 random numbers in the RangeInclusive min..=max
- set_
seeds - Manual initialisation of SEED (and derived xoshi seeds). When seed == 0, resets SEED to a few elapsed nanoseconds, producing an essentially unpredictable new random sequence. Otherwise sets the SEED to the supplied argument value, which will repeat the same unique sequence for each value.
- stringv
- stringifies a generic slice for printing
- stringvv
- stringifies a generic slice of vectors for printing