Expand description
Random number module - port of Modules/random.c
Provides access to kernel random sources for cryptographically secure random number generation.
Structs§
- Random
State - Random number generator state
Functions§
- fill_
random_ bytes - get_
bounded_ random - Get random integers bounded by max (exclusive) Uses Lemire’s algorithm for unbiased bounded random numbers
- get_
bounded_ random_ buffer - Fill buffer with bounded random integers
- get_
random_ u32 - Get a single random u32
- get_
random_ u64 - Get a single random u64
- random_
range - Generate a random integer in range [min, max]
- random_
real - Generate a random real number in [0, 1) using 53 bits of randomness
- random_
real_ exclusive_ zero - Generate a random real number in (0, 1] (exclusive 0, inclusive 1)
- random_
real_ inclusive - Generate a random real number in [0, 1] (inclusive both ends)
- shuffle
- Shuffle a slice in place using Fisher-Yates algorithm
- zrand_
float - zrand_float math function implementation Returns a random floating-point number between 0 and 1
- zrand_
int - zrand_int math function implementation Arguments: upper (optional), lower (optional), inclusive (optional)