Debian Codegraph @

libutil/mt19937ar/mt19937ar-test.c

raw
1 #include "mt19937ar.h"
2
3 // The MD5 checksum of the correct output is
4 // cb33e6acc162cbe20f7fcac26adddd02
5 // and it is 22465 bytes long.
6 //
7 // but we cannot use md5, as it's in libbri, and
8 // so is this...
9
10 int main(void) {
11 int i;
12 uint32 init[4] = {0x123, 0x234, 0x345, 0x456};
13 uint32 length = 4;
14 mt_s *ctx = mtInitArray(init, length);
15
16 printf("1000 outputs of genrand_int32()\n");
17
18 for (i=0; i<1000; i++) {
19 printf(uint32FMTW(10)" ", mtRandom32(ctx));
20 if (i%5==4) printf("\n");
21 }
22
23 printf("\n1000 outputs of genrand_real2()\n");
24
25 for (i=0; i<1000; i++) {
26 printf("%10.8f ", mtRandomRealOpen(ctx));
27 if (i%5==4) printf("\n");
28 }
29
30
31
32 for (i=0; i<999; i++) {
33 printf(uint64HEX" ", mtRandom64(ctx));
34 if (i%3==2) printf("\n");
35 }
36
37 return 0;
38 }