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

Re: Seed problem in FXSL randomizeList

Subject: Re: Seed problem in FXSL randomizeList
From: Jesper Tverskov <jesper.tverskov@xxxxxxxxx>
Date: Wed, 7 Oct 2009 11:50:50 +0200
Re:  Seed problem in FXSL randomizeList
Thanks for the hint Michael.

I now do this for the first seed:
xs:integer(format-time(current-time(), '[s][f]'))

The sequence of positions returned is then kept in a variable x like this:

<xsl:variable name="x">
   <xsl:call-template name="randomizeList">
    <xsl:with-param name="pList" select="(1 to count(/items/item))[. != $num]"/>
    <xsl:with-param name="pSeed" select="$pSeed" as="xs:integer"/>
   </xsl:call-template>
  </xsl:variable>

The second seed is then generated like this:

xs:integer(substring(string-join($x/el[position() &lt; 6], ''), 1, 4))

Etc, and again for the third seed, etc, and it looks like it works well.
I'm now more confident that the pseudo-randomization is random!

Cheers,
Jesper

http://www.xmlplease.com

Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

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.
Email
First Name
Last Name
Company
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-2011 All Rights Reserved.