|
From:
<br...@ph...> - 2006-05-12 01:13:55
|
Daniel J Sebald wrote: > Another observation: setting the seed of rand() is slightly clumsy, > from what I see so far. Not at all, IMHO. It does exactly what it says it does, with semantics following traditions of how rand() functions behave that go back at least to the C64 and the original IBM BASIC. > Certainly, it doesn't make sense to set the seed, e.g., rand(123), as > part of a plot function because it will simply be drawing the same > sample time and again. So, it seems that whenever rand() is used to > seed the random number generator it should be on its own. You can still do it from inside a plot command, because of the old, easily overlooked "inline assignment" feature: splot unused=rand(123), "data", invnorm(rand(0)) > gnuplot doesn't accept "rand()" as a command. (Perhaps it should.) If at all, that command would be "set random [.. some options ...]" > notusedval = rand(123) ... or you could use print rand(123) > after it is called will not have a seed of 123, but actually something > different. Since we make no promises whatsoever about the rand() algorithm, to "have a seed of 123" is quite completely meaningless anyway, so I really can't see what's there to worry about. I, for one, would be quite surprised by a PRNG that returned the seed I set as the next random number, instead of using it to replace the state that the previous call left the PRNG in. rand(123) is a *function*, not a command, and I'm going to have to insist that it stays that way. |