"glen herrmannsfeldt" <g...@ugcs.caltech.edu> wrote in message news:gpk28b$s73$1@naig.caltech.edu... > Richard Maine <nos...@see.signature> wrote: > (snip on RANDOM_SEED, I wrote)
> >> It might not be so easy for some to supply a > >> different number each time.
> > That was not the issue at all. That's pretty much a non-issue in terms > > of the standard. It would be trivial to just say that it did not need to > > be the same each time, perhaps with a suggestion that the processor > > might make it different if practical.
> Yes that would have worked, though it really isn't much > help to someone actually using it. Well, overall I don't > like the way RANDOM_SEED works. Many RNGs have requirements > on what makes a 'good' seed. It would be nice to be able to > supply a single INTEGER such that RANDOM_SEED would select > a good seed based on that. Instead, you have to supply > N integers.
N can equal 1, thus a single integer. Or, if you want it simple, none at all.
> RANDOM_SEED has to be able to make a good > seed out of those N integers, in addition to be able to > accept a seed previously obtained from RANDOM_SEED.
> The restoring of a previously stored seed should > be a separate operation from seeding from outside > entropy (randomness). The latter should allow any > number of words of input, from one, to N or more.
> "glen herrmannsfeldt" <g...@ugcs.caltech.edu> wrote in message news:gpk28b$s73$1@naig.caltech.edu... >> Richard Maine <nos...@see.signature> wrote: >> (snip on RANDOM_SEED, I wrote)
>>>> It might not be so easy for some to supply a >>>> different number each time.
>>> That was not the issue at all. That's pretty much a non-issue in terms >>> of the standard. It would be trivial to just say that it did not need to >>> be the same each time, perhaps with a suggestion that the processor >>> might make it different if practical.
>> Yes that would have worked, though it really isn't much >> help to someone actually using it. Well, overall I don't >> like the way RANDOM_SEED works. Many RNGs have requirements >> on what makes a 'good' seed. It would be nice to be able to >> supply a single INTEGER such that RANDOM_SEED would select >> a good seed based on that. Instead, you have to supply >> N integers.
> N can equal 1, thus a single integer. > Or, if you want it simple, none at all.
W/e.
This is a good seed:
contains subroutine init_seed() integer :: n, ival(8), v(3), i integer, allocatable :: seed(:) call date_and_time(values=ival) v(1) = ival(8) + 2048*ival(7) v(2) = ival(6) + 64*ival(5) ! value(4) isn't really 'random' v(3) = ival(3) + 32*ival(2) + 32*8*ival(1) call random_seed(size=n) allocate(seed(n)) call random_seed() ! Give the seed an implementation-dependent kick call random_seed(get=seed) do i=1, n seed(i) = seed(i) + v(mod(i-1, 3) + 1) enddo call random_seed(put=seed) deallocate(seed) end subroutine
Tja. -- Frank
Mistakes are a part of being human. Appreciate your mistakes for what they are: precious life lessons that can only be learned the hard way. Unless it's a fatal mistake, which, at least, others can learn from. ~~ Al Franken,