SQRT(RAN#×RAN#) - what is the distribution?
04-06-2019, 09:54 PM
Post: #4
 Valentin Albillo Senior Member Posts: 916 Joined: Feb 2015
RE: SQRT(RAN#×RAN#) - what is the distribution?
.
Hi,

(04-06-2019 03:17 PM)Csaba Tizedes Wrote:  My first idea was that, I can increase the number of different random numbers, if I calculate SQRT(RAN#×RAN#). I am sure this will increase the number of numbers, but what about the distribution?

What you're doing essentially amounts to returning as your random number the geometric mean of two other random numbers and this will certainly never result in a uniform distribution for your returned value if that was the distribution of the two factors. Take logarithms if you doubt it.

Also, you're essentially multiplying two 3-digit integer numbers from 000 to 999, (then dividing by 106) so you'll never get one million different values as you should, first because multiplication is commutative so you'd only get half that many, but also because all prime numbers less than one million would never appear even once as a product, while numbers with many low divisors would appear muliple times (think of, say 36 and 37: the latter, being prime, would never appear as a product while the former would appear as the result of 1*36, 2*18, 3*12, 4*9, 6*6, ...) and this would ruin even further the uniformity, there would be some very strong bias for certain numbers.

ijabbott ideas are the way to go: simple, fast and effective.

Finally, may I suggest that instead of using a pure MonteCarlo scheme, which converges to the correct integral on the order of 1/Sqrt(N), i.e., dismayingly slowly, you migh want to consider a Quasi-MonteCarlo procedure, which converges much faster while still retaining most advantages of MonteCarlo methods in general. Just saying.

V.
.

All My Articles & other Materials here:  Valentin Albillo's HP Collection

 « Next Oldest | Next Newest »

 Messages In This Thread SQRT(RAN#×RAN#) - what is the distribution? - Csaba Tizedes - 04-06-2019, 03:17 PM RE: SQRT(RAN#×RAN#) - what is the distribution? - ijabbott - 04-06-2019, 03:53 PM RE: SQRT(RAN#×RAN#) - what is the distribution? - Csaba Tizedes - 04-06-2019, 07:40 PM RE: SQRT(RAN#×RAN#) - what is the distribution? - Valentin Albillo - 04-06-2019 09:54 PM RE: SQRT(RAN#×RAN#) - what is the distribution? - Albert Chan - 04-21-2019, 08:58 PM

User(s) browsing this thread: 1 Guest(s)