Re: [xsl] Random number seed generation

Subject: Re: [xsl] Random number seed generation
From: Michel Hendriksen <michel.hendriksen@xxxxxxxxx>
Date: Thu, 9 Dec 2010 19:25:39 +0100
I see some possibilities like passing seed as parameter to templates
or within the data, which is at least partly regenerated each
generation in the evolution steps.

Most code is/will be recursive.

Michel

On Thu, Dec 9, 2010 at 4:37 PM, Michael Kay <mike@xxxxxxxxxxxx> wrote:
> On 09/12/2010 14:04, Michel Hendriksen wrote:
>>
>> Hi all,
>>
>> I'm using Saxon9he processor XSLT 2.0, and I am trying to get some
>> random numbers. I'm currently using fxsl/random for this. The problem
>> is that it needs a seed.
>> I tried using current time stuff but that doesn't change during the
>> transfomation using the stylesheet.. So I tried an extension function
>> to cal to Java but that doesn't seem to work. Examples are probably
>> XSLT 1.0 but should be ok.
>>
>
> You need to organize your code so that all the random numbers come from a
> single sequence from a single seed; or alternatively, generate one random
> sequence and use the numbers from this as seeds for subsidiary random
> sequences.
>
> Can't tell you how to do that without knowing more about your code. It can
> be tricky - it may involve turning iterative code into recursive code.
>
> Michael Kay
> Saxonica

Current Thread