Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.
29277 Discussions

Random number generator in Fortran 90 compiler 7.1

postaquestion
Novice
961 Views
I have noticed that there is a difference between the random number generator function rand() on Fortran 90 compiler version 7.1 and 9.1. I really need to be consistent in a code I am running and so would be very grateful if you could point me in the direction of where to obtain the older random number generator.
0 Kudos
3 Replies
Steven_L_Intel1
Employee
961 Views
I don't think you can use the 7.1 RAND with 9.1. If you have such a need, your best bet is to not use the compiler's generator and add source for a generator of your choice to your application.
0 Kudos
mccikpc2
Beginner
961 Views
Thank you for your reply. However, I have all ready tried this. I saw that the old RAND uses the `Marsaglia' algorithm, whilst the new one uses the `Park and Miller' algorithm (this is only true on Linux; on Windows, all versions seem to use the `Park and Miller' algorithm). The problem I am having is finding source code for this algorithm, for my application to be consistent with older runs, I need to be able to generate exactly the same random number sequence as the older Marseglia algorithm. Therefore I need the exact source code of the old algorithm. I have looked at several random number functions (netlib, randlib, numerical recipes in C) but can't seem to find a match. The problem is that, unsurprisingly, Marseglia has written a few algorithms for the generation of random numbers, which makes finding the correct one difficult. My thoughts are that perhaps you may have source or know where to find source code for the old RAND?
0 Kudos
mccikpc2
Beginner
961 Views
Actually, after much searching on the web, I eventually found the source code for the old algorithm. At least, it gives me the same answer as the old algorithm. It is at:
http://www.cisl.ucar.edu/zine/96/spring/articles/3.random-6.html#2

Thanks anyway!
Paul
0 Kudos
Reply