From: glen herrmannsfeldt on
steve <kargls(a)comcast.net> wrote:
> On Nov 17, 6:41?am, Gordon Sande <g.sa...(a)worldnet.att.net> wrote:

>> There is a common issue about whether the sequence should always
>> default to the same one for ease of debugging or should it be "random".

> I'm well aware of this issue because I'm the person that decided
> gfortran should default to a given sequence if one does not call
> random_seed. I made this decision precisely as you state "for the
> ease of debugging."

I think I agree with this in the case of no call to RANDOM_SEED.
It would, however, be nice if a call to RANDOM_SEED() with no
arguments did choose a good seed based on something, such as the
current time/date. (That is, for example, the way that many early
BASIC systems did it, though it is hard to say that there is any
standard for BASIC.)

While one can use DATE_AND_TIME to extract the date/time and then
use that as a seed, there is no way to know what constitutes
a good seed. Duplicating the values as many times as needed
to fill up the seed array may or may not supply a good seed.

It would be nice to have a way to generate a good seed based
on a single default kind integer. Again, duplicating to fill
the seed array is likely not the best choice.

-- glen
From: Gordon Sande on
On 2009-11-17 11:37:29 -0400, nmm1(a)cam.ac.uk said:

> In article <2009111711204716807-gsande(a)worldnetattnet>,
> Gordon Sande <g.sande(a)worldnet.att.net> wrote:
>> On 2009-11-17 11:13:29 -0400, steve <kargls(a)comcast.net> said:
>>>
>>>> There is a common issue about whether the sequence should always
>>>> default to the same one for ease of debugging or should it be "random".
>>>
>>> I'm well aware of this issue because I'm the person that decided
>>> gfortran should default to a given sequence if one does not call
>>> random_seed. I made this decision precisely as you state "for the
>>> ease of debugging."
>>
>> The only folks who I have heard question such a choice are beginners
>> who are surprised when the random sequence is always the same on their
>> successive runs (that are often for debugging :-( ). It was not really
>> fair to call it an issue even if it does confuse a few beginners.
>
> Then try me. I am one of the experts who takes the converse view,
> on the grounds of statistical validity. In particular, using the
> same numbers to test two related analyses gives erroneous results
> if you compare the analyses statistically assuming independence.
> A classic error of scientists who ought to know better.

The usual professional advice is that such experiments need to record
both the random number generater used as well as the seed value so
that rerunning would be possible. Implicitly this says that differing
experiments should have different seeds.

> However, I accept that it is a matter of judgement which choice will
> lead to more wrong answers, overall.

Too many folks act like beginners. A kinder way of saying this is that
people are specialized but problems are not so not all problems are solved
as professionally as one might hope.

> Regards,
> Nick Maclaren.


From: steve on
On Nov 17, 9:00 am, glen herrmannsfeldt <g...(a)ugcs.caltech.edu> wrote:
> steve <kar...(a)comcast.net> wrote:
> > On Nov 17, 6:41?am, Gordon Sande <g.sa...(a)worldnet.att.net> wrote:
> >> There is a common issue about whether the sequence should always
> >> default to the same one for ease of debugging or should it be "random"..
> > I'm well aware of this issue because I'm the person that decided
> > gfortran should default to a given sequence if one does not call
> > random_seed.  I made this decision precisely as you state "for the
> > ease of debugging."
>
> I think I agree with this in the case of no call to RANDOM_SEED.
> It would, however, be nice if a call to RANDOM_SEED() with no
> arguments did choose a good seed based on something, such as the
> current time/date.  (That is, for example, the way that many early
> BASIC systems did it, though it is hard to say that there is any
> standard for BASIC.)

I respectfully disagree with your second sentence because person
will need to make 2 calls to RANDOM_SEED(); one to reseed the PRNG
and one to record the set of seeds.

> While one can use DATE_AND_TIME to extract the date/time and then
> use that as a seed, there is no way to know what constitutes
> a good seed.  Duplicating the values as many times as needed
> to fill up the seed array may or may not supply a good seed.
>
> It would be nice to have a way to generate a good seed based
> on a single default kind integer.  Again, duplicating to fill
> the seed array is likely not the best choice.

gfortran's random_seed() in principle has a mechanism in
place to help prevent a user from making a bad choice of
seeds. Whether the mechanism is effective, I do not know.

--
steve

From: e p chandler on
On Nov 16, 4:58 pm, Marina <levin.mar...(a)gmail.com> wrote:
> Hi,
>
> I have a question regarding the subroutine RANDOM_NUMBER,
> does it generate a list of uniformly distributed numbers, between 0
> and 1, and an average of 0.5?

The average is a property of the distribution, not the generator. The
Fortran standard says nothing about its qualidy, just its interface.

> Which other intrinsic random number generating subroutines are
> available for Fortran 90, for other distributions?

Only uniform(0,1) is intrinsic. Others are gernrally built from the
uniform distribution.

There is an ENORMOUS literature on this subject. For example there are
standard texts by Knuth, Gentle, Law and Kelton, and many others. Also
textbooks on mathematical statistics cover this subject
(transfomration of random variables) in detail.

> (I found that the function rand() doesn't work in my compiler, for example.)

It's not part of the standard. Vendors offer many RNGs as extensions.

My general advice to you is:

1. Determine what distribution you want to model.
2. Consult a specialist in random number generation and statistics.
3. Test, test and test.

---- elliot

From: glen herrmannsfeldt on
steve <kargls(a)comcast.net> wrote:
(snip, I wrote)

>> It would be nice to have a way to generate a good seed based
>> on a single default kind integer. ?Again, duplicating to fill
>> the seed array is likely not the best choice.

> gfortran's random_seed() in principle has a mechanism in
> place to help prevent a user from making a bad choice of
> seeds. Whether the mechanism is effective, I do not know.

How does it know if it is a user supplied seed value, or a
previously stored seed from RANDOM_SEED? I think what I would
most like to see is separate ways for restoring a previous seed
and specifying a new seed. For a new seed, the routine should
generate a good seed based on user supplied data. When restoring
a seed, it should not be changed. With the assumption that all
seed values are possible, there is no way to tell the difference.

I suppose one could put a CRC on the stored seed, and test it
on reloading. For a given CRC size, that makes it very unlikely
to be accidentally specified by the user.

-- glen
First  |  Prev  |  Next  |  Last
Pages: 1 2 3 4 5 6 7 8 9 10 11 12 13
Prev: pointer and allocatable arrays
Next: f95 to windows dll