Can some one tell me why the following program generates random number
between 2**15-1, even when I am using the BSD version. I used the
following command to compile and link:
cc -D_BSD -DBSD -DAIX randeg.c -lbsd -lc
I looked up the info pages of rand where it says that you need to use
-lbsd to generate random numbers between 2**32-1. Any help will be
appreciated. Thanks in advance.
System: IBM RS/6000 AIX 3.2.3
^^^^^^^
Program (randeg.c):
^^^^^^^^^^^^^^^^^^^
#include <stdio.h>
#include <sys/types.h>
#include <stdlib.h>
#define N 20
main ()
{
int i;
for (i=0; i<N;i++)
printf("%2d) - %d\n", i, rand());
return 0;
Output:Quote:}
^^^^^^^
0) - 16838
1) - 5758
2) - 10113
3) - 17515
4) - 31051
5) - 5627
6) - 23010
7) - 7419
8) - 16212
9) - 4086
10) - 2749
11) - 12767
12) - 9084
13) - 12060
14) - 32225
15) - 17543
16) - 25089
17) - 21183
18) - 25137
19) - 25566
--
===========================================================================
Binod Taterway, Sr. User Consultant, Lehigh Univ. Computing Center
------------------------------------------------------------------
===========================================================================