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:


> 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.

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

This archive was generated by hypermail 2.3.1 : Wednesday, 7 January 2015 15:01:02 UTC