xsl-list
[Top] [All Lists]

RE: Re: A proposal:xsl:result-document asynchronous attribute

2003-03-11 04:41:26
I wonder what we can do about random number generation. 

I think the simplest solution for most use cases involving random
numbers is a function that permutes a supplied sequence into random
order:

To deal a deck of cards:

<xsl:for-each select="random(1 to 52)">
   ...
</xsl:for-each>

To select 1000 people chosen at random:

<xsl:for-each select="subsequence(random(//person), 1, 1000)">
   ...
</xsl:for-each>


Michael Kay
Software AG
home: Michael(_dot_)H(_dot_)Kay(_at_)ntlworld(_dot_)com
work: Michael(_dot_)Kay(_at_)softwareag(_dot_)com 


 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list



<Prev in Thread] Current Thread [Next in Thread>