W3C home > Mailing lists > Public > public-rdf-dawg@w3.org > October to December 2010

Re: Proposed RAND() defn

From: Andy Seaborne <andy.seaborne@epimorphics.com>
Date: Thu, 02 Dec 2010 11:38:55 +0000
Message-ID: <4CF7854F.8080509@epimorphics.com>
To: Steve Harris <steve.harris@garlik.com>
CC: SPARQL Working Group <public-rdf-dawg@w3.org>
>>
>> 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 GMT

This archive was generated by hypermail 2.3.1 : Tuesday, 26 March 2013 16:15:44 GMT