Re: [xsl] Seed problem in FXSL randomizeList

Subject: Re: [xsl] Seed problem in FXSL randomizeList
From: Jesper Tverskov <jesper.tverskov@xxxxxxxxx>
Date: Wed, 7 Oct 2009 11:50:50 +0200
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"/>

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!


Current Thread