summaryrefslogtreecommitdiff
path: root/kit/mersenne_twister_64.h
blob: 2709dd766d0d940c93621ab847fb28d3ed9c8353 (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
25
26
27
28
29
30
31
32
33
34
35
#ifndef KIT_MERSENNE_TWISTER_64_H
#define KIT_MERSENNE_TWISTER_64_H

#include "types.h"

#ifdef __cplusplus
extern "C" {
#endif

enum {
  KIT_MT64_N = 312,
};

typedef struct {
  u64 mt[KIT_MT64_N];
  u64 index;
} kit_mt64_state_t;

void kit_mt64_init_array(kit_mt64_state_t *state, i64 size,
                         u64 *seed);
void kit_mt64_init(kit_mt64_state_t *state, u64 seed);
void kit_mt64_rotate(kit_mt64_state_t *state);
u64  kit_mt64_generate(kit_mt64_state_t *state);

#ifdef __cplusplus
}
#endif

#define mt64_state_t kit_mt64_state_t
#define mt64_init_array kit_mt64_init_array
#define mt64_init kit_mt64_init
#define mt64_rotate kit_mt64_rotate
#define mt64_generate kit_mt64_generate

#endif