r6308@lvps87-230-33-50: verhaegs | 2007-12-03 22:24:30 +0100
[AROS.git] / test / randtest.c
blob17ffef92984abc3dbd62288e069b0218331e3d8d
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 double d = drand48();
28 int * iptr = (int *)&d;
29 int a = iptr[0];
30 int b = iptr[1];
32 printf("%d. %e (%x %x) %x\n",c,d,a,b,array[c]);
33 c++;
36 lcong48(param);
37 c = 0 ;
38 while (c < 30)
40 printf("%d. %lx\n",c,lrand48());
42 c++;
45 sptr = seed48(seed16v);
46 printf("---\n %x,%x,%x\n",sptr[0],sptr[1],sptr[2]);
47 c = 0 ;
48 while (c < 30)
50 printf("%d. %lx\n",c,lrand48());
51 c++;
53 printf("---\n");
55 c = 0 ;
56 while (c < 10)
58 printf("%d. %e (%x,%x,%x)\n",c,erand48(xsubi),xsubi[0],xsubi[1],xsubi[2]);
59 c++;
61 printf("---\n");
63 c = 0 ;
64 xsubi[0] = 0;
65 xsubi[1] = 1;
66 xsubi[2] = 0;
67 while (c < 10)
69 printf("%d. %lx (%x,%x,%x)\n",c,nrand48(xsubi),xsubi[0],xsubi[1],xsubi[2]);
70 c++;
72 printf("---\n");
74 c = 0 ;
75 while (c < 10)
77 printf("%d. %lx (%x,%x,%x)\n",c,jrand48(xsubi),xsubi[0],xsubi[1],xsubi[2]);
78 c++;
82 return 0;