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

Re: generating unique random numbers

Subject: Re: generating unique random numbers
From: Abel Braaksma <abel.online@xxxxxxxxx>
Date: Mon, 22 Feb 2010 11:36:42 +0100
Re:  generating unique random numbers
As an alternative to the already proposed solutions, consider looking up the pseudo-random method to create GUIDs in XSLT, which I cooked up a few years ago: http://markmail.org/message/4zxb654yeaf5twnv

It is random enough between runs (and sequential, yet non-repeating, in one run), but maybe not random enough for you. You can elaborate on the code, of course. But Dimitre's XSLT-only approach to pseudo-random numbers in FXSL, combined with distinct-values() will probably be a better course of action.

Kind regards,
Abel Braaksma

Wolfgang Laun wrote:
What you describe is not a sequence of random numbers; a rule such as
"no duplicates" contradicts most definitions of "randomness". What you
request is better described as "a random permutation of numbers". This could
be produced by random draws from a set of numbers (without returning)
provided that you can, somehow, define this set. Can you?

I regret that I'm not experienced enough to propose an XSLT solution
for such an algorithm.

-W

On Sun, Feb 21, 2010 at 3:02 AM, a kusa <akusa8@xxxxxxxxx> wrote:
Hi

I have been raking my brains to achieve this. I am using math.random()
to generate random numbers, but of course since they repeat, I want to
be able to generate unique random numbers. Can anybody please help me
here? How can I generate unique random numbers in xslt?

Thanks in advance for all your support.

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.