This is the mail archive of the
fortran@gcc.gnu.org
mailing list for the GNU Fortran project.
Re: Random number seed size
- From: Steve Kargl <sgk at troutmask dot apl dot washington dot edu>
- To: Michael Clover <MICHAEL dot R dot CLOVER at saic dot com>
- Cc: "fortran at gcc dot gnu dot org" <fortran at gcc dot gnu dot org>
- Date: Mon, 2 Feb 2009 14:56:03 -0800
- Subject: Re: Random number seed size
- References: <C5AC7055.50B8%michael.r.clover@saic.com>
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