19#define A_RAND_LCG48_INIT {A_U64_C(0x5DEECE66D), A_U16_C(0xB), {A_U16_C(0x330E), A_U16_C(0xABCD), A_U16_C(0x1234)}}
24#if defined(__cplusplus)
27typedef struct a_rand_lcg48 rand_lcg48;
31#if !defined A_HAVE_INLINE || defined(LIBA_RAND_C)
34#define A_INTERN A_PUBLIC extern
107#if !defined A_HAVE_INLINE || defined(LIBA_RAND_C)
110#define A_INTERN static A_INLINE
113#if defined(__cplusplus)
125#if defined(__cplusplus)
158#if defined(LIBA_RAND_C)
161#define A_INTERN A_INLINE
164#if defined(A_HAVE_INLINE) || defined(LIBA_RAND_C)
171#if defined(LIBA_RAND_C)
174#define A_INTERN static A_INLINE
a_f64 a_rand_lcg48f(a_rand_lcg48 *ctx)
generate a 64-bit floating-point random number in [0,1).
a_f64 a_rand_lcg48f_(a_rand_lcg48 *ctx, a_u16 x[3])
generate a 64-bit floating-point random number in [0,1).
void a_rand_lcg48_init(a_rand_lcg48 *ctx, a_i64 x)
initialize with a seed value for the linear congruential generator and 48-bit integer arithmetic.
a_u64 a_rand_lcg48_next(a_rand_lcg48 *ctx, a_u16 x[3])
perform one iteration for the linear congruential generator and 48-bit integer arithmetic.
a_i32 a_rand_lcg48i_(a_rand_lcg48 *ctx, a_u16 x[3])
generate a signed 32-bit random integer.
a_u32 a_rand_lcg48u_(a_rand_lcg48 *ctx, a_u16 x[3])
generate an unsigned 32-bit random integer.
a_i32 a_rand_lcg48i(a_rand_lcg48 *ctx)
generate a signed 32-bit random integer.
a_u32 a_rand_lcg48u(a_rand_lcg48 *ctx)
generate an unsigned 32-bit random integer.
void a_rand_lcg48_seed(a_rand_lcg48 *ctx, a_u16 const x[3])
initialize with a specific state for the linear congruential generator and 48-bit integer arithmetic.
void a_rand_lcg48_shuf(a_rand_lcg48 *ctx, void *ptr, a_size num, a_size siz)
shuffle the elements of an array in place using the Fisher-Yates (Knuth) shuffle algorithm.
unsigned long a_u64
unsigned integer type with width of exactly 64 bits
Definition a.h:627
long a_i64
signed integer type with width of exactly 64 bits
Definition a.h:589
unsigned short a_u16
unsigned integer type with width of exactly 16 bits
Definition a.h:486
double a_f64
double precision floating point type. Matches IEEE-754 binary64 format if supported.
Definition a.h:901
long a_i32
signed integer type with width of exactly 32 bits
Definition a.h:519
unsigned long a_u32
unsigned integer type with width of exactly 32 bits
Definition a.h:538
size_t a_size
unsigned integer type returned by the sizeof operator
Definition a.h:823
instance structure for the linear congruential generator and 48-bit integer arithmetic
Definition rand.h:121
void init(a_i64 x_)
initialize with a seed value for the linear congruential generator and 48-bit integer arithmetic.
Definition rand.h:127
a_u64 next(a_u16 x_[3])
perform one iteration for the linear congruential generator and 48-bit integer arithmetic.
Definition rand.h:131
a_i32 i(a_u16 x_[3]=NULL)
generate a signed 32-bit random integer.
Definition rand.h:133
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.
Definition rand.h:151
a_u64 a
Definition rand.h:122
a_f64 f(a_u16 x_[3]=NULL)
generate a 64-bit floating-point random number in [0,1).
Definition rand.h:145
a_u16 x[3]
Definition rand.h:124
a_u32 u(a_u16 x_[3]=NULL)
generate an unsigned 32-bit random integer.
Definition rand.h:139
void seed(a_u16 const x_[3]=NULL)
initialize with a specific state for the linear congruential generator and 48-bit integer arithmetic.
Definition rand.h:129
a_u16 c
Definition rand.h:123