|
liba 0.1.15
An algorithm library based on C/C++
|
instance structure for the linear congruential generator and 48-bit integer arithmetic More...
#include <rand.h>
Public Member Functions | |
| void | init (a_i64 x_) |
| initialize with a seed value for the linear congruential generator and 48-bit integer arithmetic. | |
| void | seed (a_u16 const x_[3]=NULL) |
| initialize with a specific state for the linear congruential generator and 48-bit integer arithmetic. | |
| a_u64 | next (a_u16 x_[3]) |
| perform one iteration for the linear congruential generator and 48-bit integer arithmetic. | |
| a_i32 | i (a_u16 x_[3]=NULL) |
| generate a signed 32-bit random integer. | |
| a_u32 | u (a_u16 x_[3]=NULL) |
| generate an unsigned 32-bit random integer. | |
| a_f64 | f (a_u16 x_[3]=NULL) |
| generate a 64-bit floating-point random number in [0,1). | |
| void | shuf (void *ptr, a_size num, a_size siz) |
| shuffle the elements of an array in place using the Fisher-Yates (Knuth) shuffle algorithm. | |
Data Fields | |
| a_u64 | a |
| a_u16 | c |
| a_u16 | x [3] |
instance structure for the linear congruential generator and 48-bit integer arithmetic
generate a 64-bit floating-point random number in [0,1).
generate a signed 32-bit random integer.
|
inline |
initialize with a seed value for the linear congruential generator and 48-bit integer arithmetic.
perform one iteration for the linear congruential generator and 48-bit integer arithmetic.
|
inline |
initialize with a specific state for the linear congruential generator and 48-bit integer arithmetic.
shuffle the elements of an array in place using the Fisher-Yates (Knuth) shuffle algorithm.
generate an unsigned 32-bit random integer.
| a_u64 a_rand_lcg48::a |
multiplier term
| a_u16 a_rand_lcg48::c |
increment term
| a_u16 a_rand_lcg48::x[3] |
random value