aboutsummaryrefslogtreecommitdiff
path: root/tests/core/test_i32_mul_semiprecise.in
blob: a93a69da34cf821576bc1cbba96cfa86c433f826 (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
#include <stdio.h>

typedef unsigned int uint;

// from cube2, zlib licensed

#define N (624)
#define M (397)
#define K (0x9908B0DFU)

static uint state[N];
static int next = N;

void seedMT(uint seed) {
  state[0] = seed;
  for (uint i = 1; i < N; i++)  // if we do not do this precisely, at least we
                                // should coerce to int immediately, not wait
    state[i] = seed = 1812433253U * (seed ^ (seed >> 30)) + i;
  next = 0;
}

int main() {
  seedMT(5497);
  for (int i = 0; i < 10; i++) printf("%d: %u\n", i, state[i]);
  return 0;
}