liba 0.1.15
An algorithm library based on C/C++
Loading...
Searching...
No Matches
rand.h File Reference

pseudorandom number generator More...

#include "a.h"
Include dependency graph for rand.h:

Go to the source code of this file.

Data Structures

struct  a_rand_lcg48
 instance structure for the linear congruential generator and 48-bit integer arithmetic More...

Macros

#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)}}

Typedefs

typedef struct a_rand_lcg48 a_rand_lcg48
typedef struct a_rand_lcg48 a::rand_lcg48

Functions

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.
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.
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)
 generate a signed 32-bit random integer.
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)
 generate an unsigned 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_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_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.

Detailed Description