Subject: Re: [xsl] help with random numbers From: "C. M. Sperberg-McQueen cmsmcq@xxxxxxxxxxxxxxxxx" <xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx> Date: Thu, 17 Nov 2022 17:28:07 -0000 |
"Michael Kay michaelkay90@xxxxxxxxx" <xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx> writes: > Beware of the natural tendency to distrust your analysis because it > doesn't produce the answers you were expecting. That is a good warning: gut feelings can be helpful, but cannot usually be trusted when it comes to probabilities and random numbers. Which is why it's helpful to be able to test one's use of random numbers by computing expected results for some cases and comparing those expectations to the results one is getting with the random number generator. I like Dimitre Novatchev's approach: using his random number generator to produce a Monte Carlo estimation of a number for which a closed-form solution is known. In my case, I followed up my gut feelings by calculating the probability of the one particular pattern described earlier. It is possible, of course, that my calculation was flawed and the probability is not actually 0.32 -- but at least one version of my code is clearly doing something wrong: my initial code consistently produced that pattern about 80% of the time, and my current code consistently produces it about 21% of the time. They cannot both be right (and currently I believe neither is). I am prepared to be surprised by the results of my simulations, but before I can be surprised I have to trust the simulation, and that trust must be earned. Otherwise I am in the position of a mark who learns, to his surprise, that the probability of a coin coming up heads is not 50% but more like 75% ... I have noticed, I think, that discussions of pseudo-random number generators are generally careful to stress that *over the long term* every value in the distribution should (if things are going right) have an equal probability of appearance. They conspicuously avoid making that claim for any individual call. I think that means that in my situation, calculating a sequence of random numbers in advance may produce better results (here: results that converge towards some value known by other means) than repeated calls with different keys. > Having said that, it does seem that your method of using small > integers as seeds and then only using two or three numbers from the > resulting sequence is flawed. Yes; when comparing a random number in the range (0,1) to a predefined probability that the next step will be a particular one, it is likely to be only the first few digits that matter. -- C. M. Sperberg-McQueen Black Mesa Technologies LLC http://blackmesatech.com
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [xsl] help with random numbers, Michael Kay michaelk | Thread | [xsl] Jaxen 2.0.0 Beta 1, Elliotte Rusty Harol |
Re: [xsl] help with random number g, C. M. Sperberg-McQue | Date | Re: [xsl] help with random number g, Dimitre Novatchev dn |
Month |