Go to the source code of this file.
|
bool | brahe_prng_init (brahe_prng_state_t *prng_state, const brahe_prng_type_t type, const uint32_t seed) |
| Initialize a psuedo-random number generator (PRNG) More...
|
|
void | brahe_prng_free (brahe_prng_state_t *prng_state) |
| Free resources used by PRNG. More...
|
|
uint32_t | brahe_prng_next (brahe_prng_state_t *prng_state) |
| Get the next integer. More...
|
|
uint32_t | brahe_prng_range (brahe_prng_state_t *prng_state, const uint32_t lo, const uint32_t hi) |
| Get the next integer in the range [lo,hi]. More...
|
|
size_t | brahe_prng_index (brahe_prng_state_t *prng_state, const size_t length) |
| Get the next random value as a size_t index. More...
|
|
double | brahe_prng_real1 (brahe_prng_state_t *prng_state) |
| Get the next number in the range [0,1]. More...
|
|
double | brahe_prng_real2 (brahe_prng_state_t *prng_state) |
| Get the next number in the range [0,1) More...
|
|
double | brahe_prng_real3 (brahe_prng_state_t *prng_state) |
| Get the next number in the range (0,1) More...
|
|
double | brahe_prng_real53 (brahe_prng_state_t *prng_state) |
| Get the next number in the range [0,1) More...
|
|
◆ brahe_prng_type_t
Enumerator |
---|
BRAHE_PRNG_MARSENNE_TWISTER | Marsenne Twister (Matsumoto & Nishimura)
|
BRAHE_PRNG_KISS | Keep is Simple, Stupid (Marsaglia)
|
BRAHE_PRNG_CMWC4096 | CMWC4096 (Marsaglia)
|
BRAHE_PRNG_MWC1038 | MWC1038 (Marsaglia)
|
BRAHE_PRNG_ISAAC | Indirect, Shift, Accumulate, Add, and Count (Jenkins)
|
◆ brahe_prng_free()
Frees the resources used by a PRNG
- Parameters
-
prng_state | Object containing the state of a PRNG |
- Returns
- true if successful, false if failed
◆ brahe_prng_index()
Returns the next value as a size_t "index" in the range [0,length).
- Parameters
-
prng_state | Object containing the state of a PRNG |
length | - Maximum value of result |
- Returns
- A pseudorandom size_t value
◆ brahe_prng_init()
Initializes a psuedo-random number generator using a specified algorithm.
- Parameters
-
prng_state | Object to be initialized for a specific algorithm |
type | Algorithm to be used for this PRNG |
seed | Initialization seed |
- Returns
- true if successful, false if failed
◆ brahe_prng_next()
Returns the next uint32_t in sequence.
- Parameters
-
prng_state | Object containing the state of a PRNG |
- Returns
- A pseudorandom uint32_t value
◆ brahe_prng_range()
uint32_t brahe_prng_range |
( |
brahe_prng_state_t * |
prng_state, |
|
|
const uint32_t |
lo, |
|
|
const uint32_t |
hi |
|
) |
| |
Returns the next int_value between lo and hi, inclusive.
- Parameters
-
prng_state | Object containing the state of a PRNG |
lo | - Minimum value of result |
hi | - Maximum value of result |
- Returns
- A pseudorandom uint32_t value
◆ brahe_prng_real1()
Returns the next real number in the range [0,1], i.e., a number greater than or equal to 0 and less than or equal to 1. Provides 32-bit precision.
- Parameters
-
prng_state | Object containing the state of a PRNG |
- Returns
- A pseudorandom double value
◆ brahe_prng_real2()
Returns the next real number in the range [0,1), i.e., a number greater than or equal to 0 and less than 1. Provides 32-bit precision.
- Parameters
-
prng_state | Object containing the state of a PRNG |
- Returns
- A pseudorandom double value
◆ brahe_prng_real3()
Returns the next real number in the range (0,1), i.e., a number greater than 0 and less than 1. Provides 32-bit precision.
- Parameters
-
prng_state | Object containing the state of a PRNG |
- Returns
- A pseudorandom double value
◆ brahe_prng_real53()
Returns the next real number in the range [0,1), i.e., a number greater than or equal to 0 and less than 1. Provides 53-bit precision.
- Parameters
-
prng_state | Object containing the state of a PRNG |
- Returns
- A pseudorandom double value
◆ BRAHE_UNKNOWN_SEED
uint32_t BRAHE_UNKNOWN_SEED = 0 |
|
static |