![]() |
VCV Rack API v2
|
Random number generation. More...
Classes | |
struct | Xoroshiro128Plus |
xoroshiro128+. More... | |
Functions | |
void | init () |
Initializes the thread-local RNG state. More... | |
Xoroshiro128Plus & | local () |
Returns the thread-local generator. More... | |
template<typename T > | |
T | get () |
template<> | |
uint32_t | get () |
uint64_t | u64 () |
Returns a uniform random uint64_t from 0 to UINT64_MAX. More... | |
uint32_t | u32 () |
Returns a uniform random uint32_t from 0 to UINT32_MAX. More... | |
float | uniform () |
Returns a uniform random float in the interval [0.0, 1.0) More... | |
float | normal () |
Returns a normal random number with mean 0 and standard deviation 1. More... | |
void | buffer (uint8_t *out, size_t len) |
Fills an array with random bytes. More... | |
std::vector< uint8_t > | vector (size_t len) |
Creates a vector of random bytes. More... | |
Random number generation.
void rack::random::init | ( | ) |
Initializes the thread-local RNG state.
Must call when creating a thread, otherwise random state is undefined (might always return 0).
Xoroshiro128Plus & rack::random::local | ( | ) |
Returns the thread-local generator.
T rack::random::get | ( | ) |
|
inline |
|
inline |
Returns a uniform random uint64_t from 0 to UINT64_MAX.
|
inline |
Returns a uniform random uint32_t from 0 to UINT32_MAX.
|
inline |
Returns a uniform random float in the interval [0.0, 1.0)
|
inline |
Returns a normal random number with mean 0 and standard deviation 1.
|
inline |
Fills an array with random bytes.
|
inline |
Creates a vector of random bytes.