Post Reply 
SQRT(RAN#×RAN#) - what is the distribution?
04-06-2019, 09:54 PM
Post: #4
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
 
Visit this user's website Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
RE: SQRT(RAN#×RAN#) - what is the distribution? - Valentin Albillo - 04-06-2019 09:54 PM



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