|
From: Daniel J S. <dan...@ie...> - 2006-05-12 03:56:54
|
Ethan A Merritt wrote:
> On Thursday 11 May 2006 07:33 pm, Daniel J Sebald wrote:
>
>>Well, it depends. Here is what the gnuplot code says:
>>
>> This is a transcription from Pascal to Fortran of routine
>
> [...]
>
> The fact that this comment is in a C program doesn't bother you?
Sort of. But not too much, so long as someone tested it.
> In fact you *can* set the full 64 bits of the seed to something
> in particular if you want to. This is even documented:
>
> `rand(0)` returns a pseudo random number in the interval [0:1] generated
> from the current value of two internal 32-bit seeds.
> `rand({x,y})` for x>0 sets seed1 to x and seed2 to y
>
> Note that rand(678) is not an example of this, since 678 is not a
> complex number.
From doc:
`rand(x)` for x>0 sets both seeds to a value based on the value of x.
> But since the documentation does not say what those
> two internal seeds will be used for, the reader is really no wiser than before.
:-) Come on, this is getting to be semantics now. Perhaps the documentation should be one of the following two to get rid of the confusion.
1) rand({x,y})` for x>0 sets seed1 to x and seed2 to y, then generates a random number (which you can't really make much use of in a data stream) so that seed1 and seed2 become some other values.
This one can stay as it makes no promises in its wording:
`rand(x)` for x>0 sets both seeds to a value based on the value of x.
"a value based on" is sort of like "some people believe" (i.e., "this may not be factual"). So it is implying that seed1 = seed2 = x should be the result, but sure it could be interpreted as "it is whatever it is". Which leads to...
2) `rand(x)` for x>0 puts the PRNG in a known state
`rand({x,y})` for x>0 puts the PRNG in a known state
Why go through the trouble of pointing out "seed1", "seed2" or "both seeds" in the documentation if it isn't accurate?
Dan
|