Subject: Re: Re: Re: A proposal:xsl:result-document asynchronous attribute
From: "Dimitre Novatchev" <dnovatchev@xxxxxxxxx>
Date: Tue, 11 Mar 2003 21:33:52 +0100
|
"Kurt Cagle" <kurt@xxxxxxxxxxxxx> wrote in message
news:003501c2e806$d24d8a20$892afc0a@xxxxxxxxxxxxxxxxx
> Nice. I'd missed this one. Any idea how even a distribution this gives?
>
> -- Kurt
Quite sufficient for almost all uses with the exception of encryption
algorithms, perhaps. But see for yourself the results produced:
http://fxsl.sourceforge.net/articles/Random/Casting%20the%20Dice%20with%20FX
SL-htm.htm#2._Generating_a_random_sequence_following_a_distribution.Subseque
nces.
For example:
100 Random outcomes 1-6 with distribution:
<myDistribution:myDistribution>
<o>1</o><p>0.2</p>
<o>2</o><p>0.25</p>
<o>3</o><p>0.25</p>
<o>4</o><p>0.15</p>
<o>5</o><p>0.1</p>
<o>6</o><p>0.05</p>
</myDistribution:myDistribution>
Results:
2, 5, 1, 4, 3, 1, 2, 5, 4, 2,
2, 2, 1, 3, 2, 5, 2, 3, 3, 1,
1, 5, 4, 2, 5, 2, 2, 1, 1, 2,
4, 3, 1, 3, 6, 1, 2, 4, 4, 6,
3, 1, 4, 6, 2, 5, 2, 1, 1, 4,
2, 4, 2, 4, 3, 1, 3, 3, 3, 1,
4, 1, 5, 4, 1, 2, 2, 1, 6, 4,
4, 4, 2, 6, 5, 3, 2, 4, 3, 2,
2, 2, 3, 2, 3, 5, 4, 5, 2, 1,
3, 1, 2, 1, 3, 4, 2, 3, 2, 1,
As it can be seen, 6 appears for the first time only at position 35, and the
total is 5 out of 100 -- exactly the specified distribution of 0.02.
Needless to say, The original algorithm belongs to Simon Thompson and was
shamelessly reused by me from his excellent book "Haskell: The Craft of
Functional Programming".
For an explanation why the node-set randomisation algorithm is not perfect,
see:
http://haskell.org/pipermail/haskell/2003-March/011403.html
=====
Cheers,
Dimitre Novatchev.
http://fxsl.sourceforge.net/ -- the home of FXSL
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
| Current Thread |
- RE: Re: A proposal:xsl:result-document asynchronous attribute, (continued)
- Michael Kay - Tue, 11 Mar 2003 06:39:06 -0500 (EST)
- Jeni Tennison - Tue, 11 Mar 2003 07:10:33 -0500 (EST)
- Dimitre Novatchev - Tue, 11 Mar 2003 14:38:07 -0500 (EST)
- Kurt Cagle - Tue, 11 Mar 2003 14:45:27 -0500 (EST)
- Dimitre Novatchev - Tue, 11 Mar 2003 15:18:47 -0500 (EST) <=
- Michael Kay - Tue, 11 Mar 2003 05:47:14 -0500 (EST)
- bryan - Tue, 11 Mar 2003 06:08:23 -0500 (EST)
- Kurt Cagle - Mon, 10 Mar 2003 16:25:37 -0500 (EST)
- Francis Norton - Mon, 10 Mar 2003 19:55:18 -0500 (EST)
|
|