Re: Proposed RAND() defn

>>
>> Maybe we can specify RAND(seed) by simply saying that it will generate a pseudorandom sequence with the suggestion ("SHOULD") generate the same sequence on each run as a debugging aid.  This decouples it from solution sequences.
>
> A "SHOULD" is probably a good idea. It's not just a debugging aid though, it's for repeatability generally.
>
>> An implementation can be simply a random number generator like srand(N).
>
> I'm not sure who's / which srand(n) you're referring to.

This one:

http://www.gnu.org/s/libc/manual/html_node/ISO-Random.html

> The key thing is that you get the same return value twice if you do something like:
>     FILTER(RAND(1)>  0.5&&  RAND(1)<  0.6)

For me, that's not necessary.  For predictability, all I require is that 
each call of RAND(seed) returns the same number at the same point in 
execution across runs.

Maybe I don't understand RAND for SQL well enough but I thought that 
RAND() returns different numbers in

     FILTER(RAND()>  0.5&&  RAND()<  0.6)

(if you want the same number assign it in some way)

As RAND() returns different numbers, so

     FILTER(RAND(1)>  0.5&&  RAND(1)<  0.6)

should, just the same numbers at the same invocation count every run.

 Andy

Received on Thursday, 2 December 2010 11:39:37 UTC