Expand description
§Blockchain Commons Random Number Utilities
bc-rand exposes a uniform API for the random number primitives used
in higher-level Blockchain Commons
projects, including a cryptographically strong random number generator
SecureRandomNumberGenerator and a deterministic random number generator
SeededRandomNumberGenerator.
These primitive random number generators implement the
RandomNumberGenerator trait to produce random numbers compatible with
the RandomNumberGenerator Swift protocol used in MacOS and iOS, which is
important when using the deterministic random number generator for
cross-platform testing.
The crate also includes several convenience functions for generating secure and deterministic random numbers.
Structs§
- Secure
Random Number Generator - A random number generator that can be used as a source of cryptographically-strong randomness.
- Seeded
Random Number Generator - A random number generator that can be used as a source of deterministic pseudo-randomness for testing purposes.
Traits§
Functions§
- fake_
random_ data - Creates a vector of random data with a fixed seed.
- fill_
random_ data - Fill the given slice with cryptographically strong random bytes.
- make_
fake_ random_ number_ generator - Creates a seeded random number generator with a fixed seed.
- random_
data - Generate a vector of cryptographically strong random bytes of the given size.
- rng_
fill_ random_ data - Fills the given slice with random bytes.
- rng_
next_ in_ closed_ range - rng_
next_ in_ range - Returns a random value within the specified range, using the given generator as a source for randomness.
- rng_
next_ with_ upper_ bound - Returns a random value that is less than the given upper bound.
- rng_
random_ array - rng_
random_ bool - rng_
random_ data - Returns a vector of random bytes of the given size.
- rng_
random_ u32 - thread_
rng