32 #ifndef MCKL_RANDOMC_PHILOX_H 33 #define MCKL_RANDOMC_PHILOX_H 38 #error __STDC_CONSTANT_MACROS not defined before #include<stdint.h> 93 if (++ctr->
v[0] != 0) {
96 if (++ctr->
v[1] != 0) {
103 if (++ctr->
v[0] != 0) {
106 if (++ctr->
v[1] != 0) {
109 if (++ctr->
v[2] != 0) {
112 if (++ctr->
v[3] != 0) {
120 par->
v[0] = key->
v[0];
126 par->
v[0] = key->
v[0];
127 par->
v[1] = key->
v[1];
154 state->
v[0] = hi ^ (state->
v[1]);
178 state->
v[0] = hi0 ^ (state->
v[1]);
180 state->
v[2] = hi2 ^ (state->
v[3]);
250 rng->
key.
v[0] = seed;
262 rng->
key.
v[0] = seed;
271 if (rng->
index == 2) {
284 if (rng->
index == 4) {
293 #endif // MCKL_RANDOMC_PHILOX_H
static uint32_t mckl_philox2x32_rand(mckl_philox2x32 *rng)
Generate random 32-bit integers from Philox2x32 RNG.
static void mckl_philox4x32_inc(mckl_philox4x32_ctr_t *ctr)
static uint32_t mckl_philox4x32_rand(mckl_philox4x32 *rng)
Generate random 32-bit integers from Philox4x32 RNG.
static void mckl_philox2x32_initpar(const mckl_philox2x32_key_t *key, mckl_philox2x32_par_t *par)
static void mckl_philox2x32_init(mckl_philox2x32 *rng, uint32_t seed)
Initialize Philox2x32 RNG state.
mckl_philox4x32_ctr_t ctr
mckl_philox4x32_key_t key
static void mckl_philox2x32_gen(const mckl_philox2x32_ctr_t *ctr, const mckl_philox2x32_key_t *key, mckl_philox2x32_ctr_t *state)
Generate Philox2x32 RNG state.
Philox2x32 RNG state structure.
static void mckl_philox4x32_initpar(const mckl_philox4x32_key_t *key, mckl_philox4x32_par_t *par)
Philox4x32 RNG state structure.
static void mckl_philox4x32_bumpkey(mckl_philox4x32_par_t *par)
mckl_philox2x32_key_t key
mckl_philox2x32_ctr_t state
static void mckl_philox2x32_bumpkey(mckl_philox2x32_par_t *par)
static void mckl_philox4x32_init(mckl_philox4x32 *rng, uint32_t seed)
Initialize Philox4x32 RNG state.
static void mckl_philox4x32_gen(const mckl_philox4x32_ctr_t *ctr, const mckl_philox4x32_key_t *key, mckl_philox4x32_ctr_t *state)
Generate Philox4x32 RNG state.
mckl_philox4x32_ctr_t state
static void mckl_philox2x32_round(mckl_philox2x32_ctr_t *state, const mckl_philox2x32_par_t *par)
static void mckl_philox4x32_round(mckl_philox4x32_ctr_t *state, const mckl_philox4x32_par_t *par)
mckl_philox2x32_ctr_t ctr
static void mckl_philox2x32_inc(mckl_philox2x32_ctr_t *ctr)