This is the mail archive of the fortran@gcc.gnu.org mailing list for the GNU Fortran 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 seed size


On Mon, Feb 02, 2009 at 09:41:41AM -0800, Michael Clover wrote:
>  Is there a fortran random number implementation that allows the seed size
> to be specified by the user?  I don¹t want the size limits of the particle
> histories to depend on the compiler used.
> 

gfortran has rand() and srand() for backwards compatiblity with
g77.  This uses a single INTEGER seed.  If portability isn't
an issue, you could use rand() to generate the 8 seed values
needed by random_number().

Note, do not try to use rand() as the prng in your MC simulations.
It isn't a very good prng.

Note also, random_seed() uses a fairly simply algorithm to 
mix the bits of the individual seeds to try to eliminate
errors with a possbly question set of seeds.

-- 
Steve


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