VCV Rack API v2
Loading...
Searching...
No Matches
rack::random Namespace Reference

Random number generation. More...

Classes

struct  Xoroshiro128Plus
 xoroshiro128+. More...
 

Functions

void init ()
 
Xoroshiro128Pluslocal ()
 Returns the generator.
 
template<typename T >
get ()
 
template<>
uint32_t get ()
 
template<>
uint16_t get ()
 
template<>
uint8_t get ()
 
template<>
bool get ()
 
template<>
float get ()
 
template<>
double get ()
 
uint64_t u64 ()
 Returns a uniform random uint64_t from 0 to UINT64_MAX.
 
uint32_t u32 ()
 Returns a uniform random uint32_t from 0 to UINT32_MAX.
 
float uniform ()
 Returns a uniform random float in the interval [0.0, 1.0)
 
float normal ()
 Returns a normal random number with mean 0 and standard deviation 1.
 
void buffer (uint8_t *out, size_t len)
 Fills an array with random bytes.
 
std::vector< uint8_t > vector (size_t len)
 Creates a vector of random bytes.
 

Detailed Description

Random number generation.

Function Documentation

◆ init()

void rack::random::init ( )

◆ local()

Xoroshiro128Plus & rack::random::local ( )

Returns the generator.

Named "local" because the generator was thread-local in previous versions.

◆ get() [1/7]

template<typename T >
T rack::random::get ( )

◆ get() [2/7]

template<>
uint32_t rack::random::get ( )
inline

◆ get() [3/7]

template<>
uint16_t rack::random::get ( )
inline

◆ get() [4/7]

template<>
uint8_t rack::random::get ( )
inline

◆ get() [5/7]

template<>
bool rack::random::get ( )
inline

◆ get() [6/7]

template<>
float rack::random::get ( )
inline

◆ get() [7/7]

template<>
double rack::random::get ( )
inline

◆ u64()

uint64_t rack::random::u64 ( )
inline

Returns a uniform random uint64_t from 0 to UINT64_MAX.

◆ u32()

uint32_t rack::random::u32 ( )
inline

Returns a uniform random uint32_t from 0 to UINT32_MAX.

◆ uniform()

float rack::random::uniform ( )
inline

Returns a uniform random float in the interval [0.0, 1.0)

◆ normal()

float rack::random::normal ( )
inline

Returns a normal random number with mean 0 and standard deviation 1.

◆ buffer()

void rack::random::buffer ( uint8_t * out,
size_t len )
inline

Fills an array with random bytes.

◆ vector()

std::vector< uint8_t > rack::random::vector ( size_t len)
inline

Creates a vector of random bytes.