- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I read the topic about random number posted previously.
As the Fortran's help files said, I referred RND$TIMESEED as the argument of the seed, I can get the different random number seqences each time.
PROGRAM temp
USE DFLIB
REAL rand
CALL SEED(RND$TIMESEED)
CALL RANDOM(rand)
print *, "random =", rand
END PROGRAM temp
Now, I meet the new problem
How can I get diffent seed for other random number generator each time, like ran2(idum) in Numerical Recipes in Fortran?
As the Fortran's help files said, I referred RND$TIMESEED as the argument of the seed, I can get the different random number seqences each time.
PROGRAM temp
USE DFLIB
REAL rand
CALL SEED(RND$TIMESEED)
CALL RANDOM(rand)
print *, "random =", rand
END PROGRAM temp
Now, I meet the new problem
How can I get diffent seed for other random number generator each time, like ran2(idum) in Numerical Recipes in Fortran?
Link Copied
2 Replies
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
The usual method for getting different sequences from RNG code, where source is provided, is to set the seed(s) from contents of the DATE_AND_TIME VALUES array, elements (5:8). Looks like that could be consistent. However, you might use RANDOM_SEED() and RANDOM_NUMBER(). The usual reason for using the Numerical Recipes functions would be to get the same sequences on different compilers, or possibly a quicker but less rigorous sequence than Fortran's own library.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Tim,
FYI, the authors of NR for Fortran, 2nd Ed. offer a $1000 reward for anyone who can demonstrate that RAN2 fails any test in a non-trivial way :).
Keith
FYI, the authors of NR for Fortran, 2nd Ed. offer a $1000 reward for anyone who can demonstrate that RAN2 fails any test in a non-trivial way :).
Keith
![](/skins/images/8B6E2C8F64F54CBD7F7262AA46F575DA/responsive_peak/images/icon_anonymous_message.png)
Reply
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page