5 /* naive statistical checks */
8 static int chkmissing(long *x)
12 for (i = 0; i < 100; i++)
14 for (i = 0; i < 8; i++)
21 static int chkrepeat(long *x)
24 for (i = 0; i < 100; i++)
25 for (j = 0; j < i; j++)
33 static int chkones(long *x)
37 for (i = 0; i < 20; i++)
39 return orx != 0x7fffffff;
42 void checkseed(unsigned seed, long *x)
46 for (i = 0; i < 100; i++)
49 t_error("weak seed %d, missing pattern in low bits\n", seed);
51 t_error("weak seed %d, exact repeats\n", seed);
53 t_error("weak seed %d, or pattern: 0x%08x\n", seed, orx);
65 for (i = 0; i < 100; i++)
67 p = initstate(1, state, sizeof state);
68 for (i = 0; i < 100; i++)
69 if (x[i] != (y = random()))
70 t_error("initstate(1) is not default: (%d) default: %ld, seed1: %ld\n", i, x[i], y);
71 for (i = 0; i < 10; i++) {
74 if (z != (y = random()))
75 t_error("setstate failed (%d) orig: %ld, reset: %ld\n", i, z, y);
79 for (i = 0; i < 100; i++)
80 if (x[i] != (y = random()))
81 t_error("srandom(1) is not default: (%d) default: %ld, seed1: %ld\n", i, x[i], y);
82 checkseed(0x7fffffff, x);
83 for (i = 0; i < 10; i++)