bgbg
03-16-2004, 10:33 AM
I've copied the ran2 function from http://lib-www.lanl.gov/numerical/bookcpdf/c7-1.pdf
.
I use time(NULL) as initial seed.
For some reason first eight numbers are totally equal from one run to another. There are some more equal nubers in other places.
I test the program with the following commands (on linux)
$ ./ran2test > one; sleep 1;
$ ./ran2test >two;
$ paste one two | awk -F' ' '{print $1-$2}' | cat -n
These commands generate two different sequences and then compare the corresponding elements.
I've attached a text file that contains the ran2 function, the test program and some outputs.
Can someone comment on this ?
.
I use time(NULL) as initial seed.
For some reason first eight numbers are totally equal from one run to another. There are some more equal nubers in other places.
I test the program with the following commands (on linux)
$ ./ran2test > one; sleep 1;
$ ./ran2test >two;
$ paste one two | awk -F' ' '{print $1-$2}' | cat -n
These commands generate two different sequences and then compare the corresponding elements.
I've attached a text file that contains the ran2 function, the test program and some outputs.
Can someone comment on this ?