- From: Michael Kay <mhk@mhk.me.uk>
- Date: Thu, 4 Mar 2004 23:07:09 -0000
- To: "'Liam Quin'" <liam@w3.org>, <public-qt-comments@w3.org>
There is a random() function defined in the EXSLT library (www.exslt.org). That's where it belongs - in a third party library that vendors can choose to implement if they think there is enough demand. We don't have to put everything in the core. Michael Kay # -----Original Message----- # From: public-qt-comments-request@w3.org [mailto:public-qt-comments- # request@w3.org] On Behalf Of Liam Quin # Sent: 04 March 2004 18:01 # 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 Thursday, 4 March 2004 18:07:21 UTC