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

Random Numbers

Valued Contributor II

The Intel manual for random numbers has :


If repeatable has the value .true. and image_distinct has the value .true.,
 the effect of a call to RANDOM_INIT is equivalent to calling RANDOM_SEED 
with a different processor-dependent value of PUT on each image 
that executes the call. 
If the invoking image index on the initial team is the same, 
the value of PUT is the same each time the program is executed.


Does anyone know what the processor dependent value is?


0 Kudos
5 Replies
Valued Contributor II

The Intel Sample uses dimension, is this the preferred style for coding?


 it is particularly interesting when one gets:

dimension(1000) y 
Black Belt Retired Employee

You can call RANDOM_SEED with the GET argument after calling RANDOM_INIT to see what it used.

Personally, I would not use DIMENSION, but it's fine. Fortran lets you specify attributes across multiple statements.

Honored Contributor I

Do you mean you want to predict the value? Or is Steve's answer enough?

Valued Contributor II

In the Intel Statement, there is a reference to a processor dependent value for the PUT.  I was interested in what is the processor dependent value and what is the "quality of this set of numbers."

As an example, many years ago in Byte, best magazine ever, in the Recreational Maths column there is an example of a genetic algorithm.  The program was described in BASIC and I coded the algorithm and essentially get the same results as the Author.  The Random Number generator in BASIC is really good.  

I tried to code the program in Fortran, and it always ran forever and never converged to the "answer".  I spent a lot of time just playing with random number generators.  

It is just fun to play with, it has no great meaning, it just one of those annoyances with Fortran that the random number generator is not of a "high" quality.  

One of the useful Random Number Models is the Box-Mueller, the people who referenced this model, usually referenced the original paper from about 1956.  So I set out to find the original, people who copy make mistakes, turns out no one had ever asked for the paper from Princeton and it took them several weeks to find it, as the group had been created in WW2 (I think) and these old monographs were long forgotten.  I have a copy on my computer somewhere.  You should not reference a paper you have not read.  

As an example, in about 1904, Baker from UIUC created a device to measure tensile strengths of mortars, great little device.  The original paper and drawing are still available readily.  ASTM copied the original and then copyrighted the whole thing, not my idea of playing a straight bat (from cricket). But there is a mistake in the copied drawing, a dimension is incorrect. Even when you point this out to the committee, it is not fixed.  


Black Belt Retired Employee

The specific value used is not likely to be interesting - only that it leads to the same sequence each time you run the program. Intel uses the L'Ecuyer 1991 algorithm - it's very good, but nowadays there are better ones. Still, those who care about RNG "quality" are best served by selecting a specific implementation (from a library or built from source) rather than relying on whatever the compiler happens to use.