Re: [xsl] generating unique random numbers

Subject: Re: [xsl] generating unique random numbers
From: Abel Braaksma <abel.online@xxxxxxxxx>
Date: Mon, 22 Feb 2010 11:36:42 +0100
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