[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: [xquery-talk] Re: Random number generation : requ

Subject: Re: [xquery-talk] Re: Random number generation : requirements
From: "Dimitre Novatchev dnovatchev@xxxxxxxxx" <xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx>
Date: Wed, 7 May 2014 20:35:50 -0000
Re: [xquery-talk]  Re: Random number generation :  requ
On Wed, May 7, 2014 at 12:08 AM, Michael Kay mike@xxxxxxxxxxxx
<xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx> wrote:
> 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.

This is why the argument passed to the number generator needs to be
the index N of the wanted random number (as the Nth number in a
generated random sequence).

In case we have a *lazy*-generated sequence, there is no additional
cost in space and computation.

Also, this is ideal to be done within a fold (or recursion in general)
-- in this case the fold does the book-keeping (like incrementing N)
for you.


Current Thread


Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
First Name
Last Name
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.