Humble script for creating the port's snapshots.
[AROS.git] / test / randtest.c
blobe14de048d207f527a7789364fadfc8a520e10d54
1 /*
2 Copyright © 1995-2014, The AROS Development Team. All rights reserved.
3 $Id$
4 */
6 #include <stdio.h>
7 #include <stdlib.h>
9 int main(void)
11 int c = 0;
12 int array[20];
13 unsigned short param[7] = {4,5,0,1,2,1,0x2};
14 unsigned short seed16v[3] = {1,2,3};
15 unsigned short xsubi[3] = {1,2,3};
16 unsigned short *sptr;
17 srand48(0x1);
19 c = 0 ;
20 while (c < 20)
22 array[c] = lrand48();
23 c++;
26 printf("---\n");
28 srand48(0x1);
29 c = 0 ;
30 while (c < 20)
32 union {
33 double d;
34 int i[2];
35 } tmp;
36 tmp.d = drand48();
37 int a = tmp.i[0];
38 int b = tmp.i[1];
40 printf("%d. %e (%x %x) %x\n",c,tmp.d,a,b,array[c]);
41 c++;
44 lcong48(param);
45 c = 0 ;
46 while (c < 30)
48 printf("%d. %lx\n",c,lrand48());
50 c++;
53 sptr = seed48(seed16v);
54 printf("---\n %x,%x,%x\n",sptr[0],sptr[1],sptr[2]);
55 c = 0 ;
56 while (c < 30)
58 printf("%d. %lx\n",c,lrand48());
59 c++;
61 printf("---\n");
63 c = 0 ;
64 while (c < 10)
66 printf("%d. %e (%x,%x,%x)\n",c,erand48(xsubi),xsubi[0],xsubi[1],xsubi[2]);
67 c++;
69 printf("---\n");
71 c = 0 ;
72 xsubi[0] = 0;
73 xsubi[1] = 1;
74 xsubi[2] = 0;
75 while (c < 10)
77 printf("%d. %lx (%x,%x,%x)\n",c,nrand48(xsubi),xsubi[0],xsubi[1],xsubi[2]);
78 c++;
80 printf("---\n");
82 c = 0 ;
83 while (c < 10)
85 printf("%d. %lx (%x,%x,%x)\n",c,jrand48(xsubi),xsubi[0],xsubi[1],xsubi[2]);
86 c++;
90 return 0;