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

Re: Random number seed generation

Subject: Re: Random number seed generation
From: Wolfgang Laun <wolfgang.laun@xxxxxxxxx>
Date: Thu, 9 Dec 2010 16:00:07 +0100
Re:  Random number seed generation
Out of curiosity: Usually, a random generator's seed needs only one setting
so that you get different sequences with different program runs. Resetting
the RG with a different seed every now and then isn't bound to make the
sequence any "randomer".

So why?
-W

On 9 December 2010 15:04, Michel Hendriksen <michel.hendriksen@xxxxx> 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.
>
> Is this possible on Home Edition? Did things change in transition to
> 2.0? Is there an other way to get some seed for the random function? I
> can't resuse the value as I would have to keep it somewhere in between
> calls. One idea would be to use generate-id() but that gives a string.
> Could be useful when this is always convertible to a number.
>
> I'm running the processor from a Java application now. It is a
> learning project and should be able to run Genetic Algorithm
> functionality, so lots of random stuff is needed.
>
> Tried:
>
>   <xslt:value-of select="math:sqrt(10)" xmlns:math="java:java.lang.Math"/>
>
>   <xslt:variable name="date" select="date:new()"
> xmlns:date="java:java.util.Date"/>
>
> As samples for getting something but errors are:
>
> Error at xslt:value-of on line 62 column 74 of selector.xsl:
>  XPST0017: XPath syntax error at char 13 on line 62 in {math:sqrt(10)}:
>   Cannot find a matching 1-argument function named
{java:java.lang.Math}sqrt()
> Error at xslt:variable on line 64 column 83 of selector.xsl:
>  XPST0017: XPath syntax error at char 10 on line 64 in {date:new()}:
>   Cannot find a matching 0-argument function named
{java:java.util.Date}new()
>
>
> Michel Hendriksen

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-2013 All Rights Reserved.