power_play/src/rand.h

18 lines
502 B
C

#ifndef RAND_H
#define RAND_H
struct rand_state {
/* If a state's seed == 0 upon a call to a related function, it will be initialized using platform's true rng source */
u64 seed;
u64 counter;
};
u64 rand_u64_from_state(struct rand_state *state);
f64 rand_f64_from_state(struct rand_state *state, f64 range_start, f64 range_end);
u64 rand_u64_from_seed(u64 seed);
u64 rand_u64_from_seeds(u64 seed_a, u64 seed_b);
f64 rand_f64_from_seed(u64 seed, f64 range_start, f64 range_end);
#endif