Q: Problem with using erand48. 
Author Message
 Q: Problem with using erand48.

I wish to generate several independent streams of pseudo-random numbers,
that is, the sequence  of  numbers in  each stream will not depend upon
how many times the routines have been called to generate  numbers  for  the  
other streams.

I am using erand48() for the above purpose, I have also declared an array
of unsigned short integers as mentioned in the man pages.

An example program is as follows:

#include <stdio.h>
#include <stdlib.h>
#include <math.h>

main()
{
int i;
double random;
unsigned short x[3];

random = erand48(x);

for(i=0;i<100;i++)
{
printf("%lf\n",random);
random = erand48(x);

Quote:
}
}

The output of the above program are negative numbers like -134219272.000000.

If anyone has any experience with erand48, any suggestion or help will
be appreciated. By the way, I am working on a Sun Sparc workstation(running openwin)
and am using gcc as my compiler.

Thanks again,

Vikas



Sat, 10 Jan 1998 03:00:00 GMT  
 
 [ 1 post ] 

 Relevant Pages 

1. Using erand48

2. erand48() implementation

3. --- Recap: Qs. about struct ---

4. Qs of getrusage()

5. Qs on Function Call on Array

6. C's Qs

7. four Qs about C

8. strtok() Qs.

9. Borland open/_rtl_open/sopen Qs

10. Various Qs on raw_interfaces_only, no_namespace, throw, smartpointers

11. VERBATUM EXAM Qs 50929

12. 2 GUI Qs

 

 
Powered by phpBB® Forum Software