This is the mail archive of the gcc-help@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Random Number Generator


Emil Block wrote:

Toon Moene wrote:

G77's actually does:

srand(iseed);
return rand();

i = irand( k ) r = rand( k ) d = drand( k ) k INTEGER*4 Input
k=0: Get next random number in the sequence k=1: Restart sequence, return first number k>0: Use as a seed for new sequence, return first number
rand REAL*4 Output
drand REAL*8 Output
irand INTEGER*4 Output

No mention of srand but the funtion exists as well as srandom.

Is G77 (rand_.c and srand_.c) doing an additional draw?
Sorry for answering this so late ...

From your description of whan Sun does, I'd say they do the same. They must use *some* function to restart the sequence, and one would hope that it were srand.

However, given the current evidence, it's hard to say. Perhaps you could ask Sun ?

--
Toon Moene - mailto:toon@moene.indiv.nluug.nl - phoneto: +31 346 214290
Saturnushof 14, 3738 XG Maartensdijk, The Netherlands
Maintainer, GNU Fortran 77: http://gcc.gnu.org/onlinedocs/g77_news.html
Join GNU Fortran 95: http://g95.sourceforge.net/ (under construction)


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]