blob: fe68d520cfd510b496fc5e817ad0dc8a14aa1133 (
plain)
| 1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
 | #ifndef LICHEN_H
#define LICHEN_H
#include <stdint.h>
// random number generation
typedef struct li_rand32_t {
  uint32_t (*rand)(void *);
  void *state;
} li_rand32_t;
struct li_xorshift32_t {
  li_rand32_t generator;
  uint64_t state;
};
// initialize an xorshift32 struct with a specific seed
void li_xorshift32_seed(struct li_xorshift32_t *xor, uint32_t seed);
// get a pseudo-random number via the xorshift algorithm
uint32_t li_xorshift32(void *s);
#endif
 |