Module fastrand::global_rng
source ยท Expand description
A global, thread-local random number generator.
Macrosยง
- integer ๐
Structsยง
- Restore
OnDrop ๐Make sure the original RNG is restored even on panic.
Constantsยง
- DEFAUL
T_ ๐RNG_ SEED - RNG ๐
Functionsยง
- Generates a random
char
in ranges a-z and A-Z. - Generates a random
char
in ranges a-z, A-Z and 0-9. - Generates a random
bool
. - Generates a random
char
in the given range. - Choose an item from an iterator at random.
- Collects
amount
values at random from the iterable into a vector. - Generates a random digit in the given
base
. - Generates a random
f32
in range0..1
. - Generates a random
f64
in range0..1
. - Fill a byte slice with random data.
- Gives back current seed that is being held by the thread-local generator.
- Generates a random
i8
in the given range. - Generates a random
i16
in the given range. - Generates a random
i32
in the given range. - Generates a random
i64
in the given range. - Generates a random
i128
in the given range. - Generates a random
isize
in the given range. - Generates a random
char
in range a-z. - random_
seed ๐ - Initializes the thread-local generator with the given seed.
- Shuffles a slice randomly.
- try_
with_ ๐rng Try to run an operation with the current thread-local generator. - Generates a random
u8
in the given range. - Generates a random
u16
in the given range. - Generates a random
u32
in the given range. - Generates a random
u64
in the given range. - Generates a random
u128
in the given range. - Generates a random
char
in range A-Z. - Generates a random
usize
in the given range. - with_
rng ๐Run an operation with the current thread-local generator.