RE: [F&O] LQ-FO-001 - random numbers

Dear Liam:
Thank you for your comment.  The Joint WGs discussed this on 4/13/2004
and decided not to add the functionality requested.  It was felt that
the external libraries adequately provided such a function. See 
http://lists.w3.org/Archives/Public/public-qt-comments/2004Mar/0065.html
and
http://lists.w3.org/Archives/Public/public-qt-comments/2004Mar/0067.html

I trust this is satisfactory.

All the best, Ashok

-----Original Message-----
From: public-qt-comments-request@w3.org
[mailto:public-qt-comments-request@w3.org] On Behalf Of Liam Quin
Sent: Thursday, March 04, 2004 10:01 AM
To: public-qt-comments@w3.org
Subject: [F&O] LQ-FO-001 - random numbers


Many languages provide a random number generator.  This can
be useful for testing; in my cases I wanted it as part of
generating SVG images.

Although it's possible to write a random number generator in
XQuery, it's hard to do with any efficiency, because a random()
function will always return the same random number (e.g. there's
no assignment to global or hidden variables).

Two obvious workarounds are (1) an external function, which isn't
always possible and isn't likely to be interoperable, and (2)
writing a function random(n) which returns the nth random
number in a series; this can then moderately easily be written
as a recursive function, with some care to avoid overflow.

I'd like to suggest either
(1) adding a random() function, possibly with an integer argument
    as outlined above, or,

(2) defining (in the future) a set of commonly needed external
    functions, and possibly adding a way to indicate that an
    external function may return different values on multiple
    invocations.

Liam

-- 
Liam Quin, W3C XML Activity Lead, http://www.w3.org/People/Quin/
http://www.holoweb.net/~liam/

Received on Monday, 19 April 2004 08:32:49 UTC