0

For example:

Out of

Math.rand()
Math.sqrt(Math.rand())
Math.pow(Math.rand(),2)

Which one is most random?

flag
1 
The phrase "most random" is nonsensical (cf. xkcd.com/221 ). You may have a mathematical question, but not as phrased. It looks like you're talking about a specific programming language here, which one? Measuring the quality of pseudorandom generators is a big topic in mathematics and theoretical computer science, but there is not enough information in this question to even begin addressing that. – François G. Dorais Apr 12 2010 at 4:21

closed as off topic by Harry Gindi, Reid Barton, Michael Lugo, Steve Huntsman, François G. Dorais Apr 12 2010 at 3:58

1 Answer

0

How could these possibly be different?

link|flag
Since the range of Math.rand() is presumably finite in any actual implementation, all three would define different probability distributions, no? – Cam McLeman Apr 12 2010 at 3:34
Does finiteness matter? Is there a random variable X such that X and sqrt(X) have the same distribution? – Michael Lugo Apr 12 2010 at 3:43
I don't know about non-trivial examples, but X = 0 (or 1) a.s. works. – Jeff Hussmann Apr 12 2010 at 4:22
I believe Math.rand() is expected to return something which appears to be uniformly distributed on [0,1]. So, without speculating about distributions on 2k+1st roots of unity, the squareroot and square are supposed to be different distributions. – Douglas Zare Apr 12 2010 at 10:32

Not the answer you're looking for? Browse other questions tagged or ask your own question.