From: steve on
On Nov 17, 1:56 pm, glen herrmannsfeldt <g...(a)ugcs.caltech.edu> wrote:
> steve <kar...(a)comcast.net> wrote:
>
> (snip, I wrote)
>
> >> There are two ways random_seed(put=...) can be used:
> >> 1) Initialize the seed based on some user supplied data.
> >> ? ?(Constant, time of day, phase of moon, etc.)
> >> 2) Restore a seed previously retrieved using random_seed(get=...)
> >> In the first case, the supplied data should be used to generate
> >> a good quality seed. ?In the second case, the data should be used
> >> as-is, such that a previous seed is restored exactly.
>
> (snip)
>
> > It appears as if you did not read the message in the fortran @ gnu
> > mailing list archive that I pointed you at with URL.   Your question
> > doesn't make sense (to me).  Random_seed() scrambles the seeds
> > when called with PUT= and it unscrambles the seeds when called
> > with GET=.  If called with no argument, the default set of seeds
> > isused.  You can use GET= and PUT= with the default set of seeds,
> > but the scrambling and unscrambling of the seeds still occurs.
> > For more details,http://gcc.gnu.org/bugzilla/show_bug.cgi?id=32812
>
> To quote from the mentioned site:
>
>   "This doesn't make miracles (i.e. provide you with a good
>    seed when you input a particularly poor one), but at least
>    it makes using the VALUES of DATE_AND_TIME less frustrating
>    (by generating visibly different streams of PRN)."
>
> It would be nice to have high quality seeds for all possible
> values of DATE_AND_TIME when used to generate seeds.

So, what bullet-proof, general-purpose, algorithm to you recommend?

> Different generators have different requirements on what
> makes a good seed.  I suppose I agree that for a sufficient
> amount of scrambling it works, assuming the scrambling
> can be inverted.

Of course, the scrambling has to be invertible by some
means; otherwise, PUT= followed by an immediate GET=
wouldn't return the desired result.

--
steve

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

>> To quote from the mentioned site:

>> ? "This doesn't make miracles (i.e. provide you with a good
>> ? ?seed when you input a particularly poor one), but at least
>> ? ?it makes using the VALUES of DATE_AND_TIME less frustrating
>> ? ?(by generating visibly different streams of PRN)."
>>
>> It would be nice to have high quality seeds for all possible
>> values of DATE_AND_TIME when used to generate seeds.

> So, what bullet-proof, general-purpose, algorithm to you recommend?

Well, if I wrote the standard I would have had different options
for restoring and initial seeding. A little late for that, though.

Otherwise, my favorite bit scrambler is the CRC32 LFSR. Some
combination of CRC32 across the words, XORing the result with
each word as it goes along. I think it isn't hard to invert
that, and XOR should be fairly fast. Byte at a time CRC32
requires a 256 word table of constants. Bit at a time is
slower, and doesn't need the table.

>> Different generators have different requirements on what
>> makes a good seed. ?I suppose I agree that for a sufficient
>> amount of scrambling it works, assuming the scrambling
>> can be inverted.

> Of course, the scrambling has to be invertible by some
> means; otherwise, PUT= followed by an immediate GET=
> wouldn't return the desired result.

Note that the standard doesn't require PUT followed by GET
to return the same value, but does require the same random
numbers be generated if either value is used with PUT.
(That is, K may be larger than the length actually used
for the seed.)

-- glen
From: robin on
From: "steve" <kargls(a)comcast.net>
Sent: Wednesday, 18 November 2009 2:07 AM
Subject: Re: Random number generators

>On Nov 17, 12:53 am, "robin" <robi...(a)bigpond.com> wrote:
>> "Marina" <levin.mar...(a)gmail.com> wrote in message
>
>> news:94929b54-dacb-4d20-9187-a988c48d5848(a)m13g2000vbf.googlegroups.com...
>> | 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?
>> |
>> | Which other intrinsic random number generating subroutines are
>> | available for Fortran 90, for other distributions?
>> | (I found that the function rand() doesn't work in my compiler, for
>> | example.)
>
>> Rand is not a standard function.

>Sure it is.

> 7.20.2.1 The rand function
> Synopsis
>1 #include <stdlib.h>
> int rand(void);

No it isn''t. That's C, not the Fortran under discussion.


From: robin on
"steve" <kargls(a)comcast.net> wrote in message news:a6ce6c2d-eb9a-4e42-80b0-e75143fa51df(a)13g2000prl.googlegroups.com...
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."

If that behaviour is required, then a call to randon_seed will obtain it.
There's no point in making the default do exactly the same thing.


From: steve on
On Nov 17, 4:59 pm, glen herrmannsfeldt <g...(a)ugcs.caltech.edu> wrote:
> steve <kar...(a)comcast.net> wrote:
>
> (snip, I quoted and wrote)
>
> >> To quote from the mentioned site:
> >> ? "This doesn't make miracles (i.e. provide you with a good
> >> ? ?seed when you input a particularly poor one), but at least
> >> ? ?it makes using the VALUES of DATE_AND_TIME less frustrating
> >> ? ?(by generating visibly different streams of PRN)."
>
> >> It would be nice to have high quality seeds for all possible
> >> values of DATE_AND_TIME when used to generate seeds.
> > So, what bullet-proof, general-purpose, algorithm to you recommend?
>
> Well, if I wrote the standard I would have had different options
> for restoring and initial seeding.  A little late for that, though.

You're evading my question. :)

You opine on generating high quality seeds for all possible
values of DATE_AND_TIME, and ask you for your bullet-proof,
generate-purpose algorithm to achieve this aim. Some how you
mutate that request into if you wrote the standard, it would
have been done differently.

> Otherwise, my favorite bit scrambler is the CRC32 LFSR.  Some
> combination of CRC32 across the words, XORing the result with
> each word as it goes along.  I think it isn't hard to invert
> that, and XOR should be fairly fast.    Byte at a time CRC32
> requires a 256 word table of constants.  Bit at a time is
> slower, and doesn't need the table.

Well, I suppose this is start. Now, take the values from
DATE_AND_TIME
and provide the algorithm that generates a high quality set of seeds.

--
steve


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