[XSL-LIST Mailing List Archive Home] [By Thread] [By Date]

Re: [xquery-talk] [xsl] Re: Random number generation : requirements

Subject: Re: [xquery-talk] [xsl] Re: Random number generation : requirements
From: "Michael Kay mike@xxxxxxxxxxxx" <xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx>
Date: Wed, 7 May 2014 07:08:39 -0000

On 7 May 2014, at 07:31, Wolfgang Laun wolfgang.laun@xxxxxxxxx
<xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx> wrote:

> I think that a random() in XSLT should be provided in a way that lets
> you call several random number generators (of the same kind) in
> parallel. Generators may exhibit a big difference between a sequence
> where all elements are due to successive calls of the same generator
> and one where a sufficient number of generators is called one by one.
> For instance: In Dimitre's example: values returned alternate between
> even and odd, and using this to generate random points (x,y) in 2D
> omits 50% of the possible points. And this is typical for an entire
> class of random generators.

One of the inherent weaknesses of any pseudo-random number generator where the
N'th value in the sequence is a function of the (N-1)th value is that it can
get into loops. For example, if the same value appears twice consecutively
(which in a truly random sequence will sometimes happen), then all subsequent
values will be the same.

Michael Kay

Current Thread