README: explain further musl-specific tweaks
[rofl0r-df-libgraphics.git] / g_src / random.h
bloba160db9b635f29a00907bd9286a811eed40a3b52
1 #ifndef RANDOM_H
2 #define RANDOM_H
4 #ifndef WIN32
5 #include <stdint.h>
6 #endif //WIN32
8 #define MT_BUFFER_NUM 10
9 #define MT_LEN 624
12 void mt_init();
13 uint32_t mt_trandom();
14 static int32_t trandom(uint32_t max=2147483647LU)
16 if(max<=1)return 0;
17 uint32_t seed=mt_trandom();
18 seed=seed%2147483647LU;
19 seed=seed/((2147483647LU/max)+1);
21 return((int32_t)seed);
23 static int32_t loadtrandom(uint32_t max=2147483647LU)
25 uint32_t seed=mt_trandom();
26 seed=seed%max;
28 return((int32_t)seed);
30 void push_trandom_uniform_seed(uint32_t newseed);
31 void push_trandom_double_seed(uint32_t newseed1,uint32_t newseed2);
32 void push_trandom_triple_seed(uint32_t newseed1,uint32_t newseed2,uint32_t newseed3);
33 void pop_trandom_uniform_seed();
34 void trandom_twist();
36 void r_num();
37 int32_t basic_random(int32_t max=2147483647);
40 #endif