W3C home > Mailing lists > Public > public-qt-comments@w3.org > April 2004

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

From: Ashok Malhotra <ashokma@microsoft.com>
Date: Mon, 19 Apr 2004 05:32:32 -0700
Message-ID: <EDB607C8AC991F40BE646533A1A673E801DC0060@RED-MSG-42.redmond.corp.microsoft.com>
To: "Liam Quin" <liam@w3.org>, <public-qt-comments@w3.org>

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 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Tuesday, 27 March 2012 18:14:33 GMT