Random

IOErr

Tag union of possible errors when getting a random seed.

This is the same as File.IOErr.

random_seed_u64! : {} => Result U64 [RandomErr IOErr]

Generate a random U64 seed using the system's source of randomness. A "seed" is a starting value used to deterministically generate a random sequence.

!! This function is NOT cryptographically secure.

This uses the u64() function of the getrandom crate to produce a single random 64-bit integer.

For hobby purposes, you can just call this function repreatedly to get random numbers. In general, we recommend using this seed in combination with a library like roc-random to generate additional random numbers quickly.

random_seed_u32! : {} => Result U32 [RandomErr IOErr]

Generate a random U32 seed using the system's source of randomness. A "seed" is a starting value used to deterministically generate a random sequence.

!! This function is NOT cryptographically secure.

This uses the u32() function of the getrandom crate to produce a single random 32-bit integer.

For hobby purposes, you can just call this function repreatedly to get random numbers. In general, we recommend using this seed in combination with a library like roc-random to generate additional random numbers quickly.