MATH.RANDOM() And Basic Logic

Asked By 10 points N/A Posted on -
qa-featured

I wrote a simple code to compare random array differences and found something that I do not quite understand.I generate 2 tables filled with random numbers.

Add differences between random numbers Print the average difference I would have expected the result to be a random number close to 0.5, but in practice it is 0.3333. Why is the array of random numbers set to 0.3 and not to 0.5?

SHARE
Answered By 10 points N/A #318481

MATH.RANDOM() And Basic Logic

qa-featured

If you have two independent random variables uniformly distributed X, Y ~ U [0,1], their absolute difference is | X-Y | follows a triangular distribution with expectation 1/3. Everything is as it should be. This distribution result, as well as the calculation of expectations, is a fairly common homework problem in probability theory. Intuition directly follows Mark’s argument.Here are histograms of absolute and not absolute differences. On the left you can see how more mass exists for smaller absolute differences, which pushes expectations down.

Related Questions