Does adding random numbers make them more random?

This is a purely theoretical question.

We all know that most, if not all, random number generators actually generate only pseudo-random numbers.

Let's say I want a random number between 10 and 20. I can do it like this ( myRandomNumber

is an integer variable):

myRandomNumber = rand(10, 20);

      

However, if I fulfill this statement:

myRandomNumber = rand(5, 10) + rand(5, 10);

      

Is this method more random?

+3


source to share


2 answers


Not.

Randomness is not cumulative. The function rand()

uses an even distribution between your two defined endpoints.

Adding two even distributions invalidates the uniform distribution. This will make a strange looking pyramid, the most likely tendency towards the center. This is due to the accumulation of a probability density function with increasing degrees of freedom.

I ask you to read the following:

Even distribution



and this:

Convolution

Pay close attention to what happens to the two uniform distributions in the upper right corner of the screen.

You can prove it yourself by writing all the sums to a file and then building in excel. Make sure you give yourself a large enough sample size. 25,000 should be enough.

+4


source


The best way to understand this is to consider the popular game "Lucky Seven". If we roll up a hexagonal matrix, we know that the probability of getting any of the six numbers is the same - 1/6. What if we roll two dice and add numbers that appear on two? The sum can vary from 2 (both dice show "one") up to 12 (both dice show "six") The probabilities of getting different numbers from 2 to 12 are no longer uniform. The probability of getting a "seven" is the highest. There can be 1 + 6, a 6 + 1, a 2 + 5, a 5 + 2, a 3 + 4 and 4 + 3. Six ways to get "seven" out of 36 possibilities. If we plot the distribution, we get a pyramid. The probabilities will be 1,2,3,4,5,6,5,4,3,2,1 (of course, each of them must be divided by 36).The pyramidal shape (and probability distribution) of the sum can be obtained using convolution. If we know the "expected value" and standard deviation ("sigma") for two random numbers, we can quickly compute the expected value of the sum of the two random numbers. The expected value is simply the addition of two individual expected values. Sigma is obtained by applying the "Pythagorean theorem" on two individual sigmas (the square root of the sum of the squares of each sigma).Sigma is obtained by applying the "Pythagorean theorem" on two individual sigmas (the square root of the sum of the squares of each sigma).Sigma is obtained by applying the "Pythagorean theorem" over two individual sigmas (the square root of the sum of the squares of each sigma).



0


source







All Articles