revert wrong commit
[AROS.git] / test / randtest.c
blobd907efb9e62f405095de4d7a006619edffd3acac
1 #include <stdio.h>
2 #include <stdlib.h>
4 int main(void)
6 int c = 0;
7 int array[20];
8 unsigned short param[7] = {4,5,0,1,2,1,0x2};
9 unsigned short seed16v[3] = {1,2,3};
10 unsigned short xsubi[3] = {1,2,3};
11 unsigned short *sptr;
12 srand48(0x1);
14 c = 0 ;
15 while (c < 20)
17 array[c] = lrand48();
18 c++;
21 printf("---\n");
23 srand48(0x1);
24 c = 0 ;
25 while (c < 20)
27 union {
28 double d;
29 int i[2];
30 } tmp;
31 tmp.d = drand48();
32 int a = tmp.i[0];
33 int b = tmp.i[1];
35 printf("%d. %e (%x %x) %x\n",c,tmp.d,a,b,array[c]);
36 c++;
39 lcong48(param);
40 c = 0 ;
41 while (c < 30)
43 printf("%d. %lx\n",c,lrand48());
45 c++;
48 sptr = seed48(seed16v);
49 printf("---\n %x,%x,%x\n",sptr[0],sptr[1],sptr[2]);
50 c = 0 ;
51 while (c < 30)
53 printf("%d. %lx\n",c,lrand48());
54 c++;
56 printf("---\n");
58 c = 0 ;
59 while (c < 10)
61 printf("%d. %e (%x,%x,%x)\n",c,erand48(xsubi),xsubi[0],xsubi[1],xsubi[2]);
62 c++;
64 printf("---\n");
66 c = 0 ;
67 xsubi[0] = 0;
68 xsubi[1] = 1;
69 xsubi[2] = 0;
70 while (c < 10)
72 printf("%d. %lx (%x,%x,%x)\n",c,nrand48(xsubi),xsubi[0],xsubi[1],xsubi[2]);
73 c++;
75 printf("---\n");
77 c = 0 ;
78 while (c < 10)
80 printf("%d. %lx (%x,%x,%x)\n",c,jrand48(xsubi),xsubi[0],xsubi[1],xsubi[2]);
81 c++;
85 return 0;