Always the same average for random numbers!?

T

The Dude

Hello :)

I am using a random number generation with a Randomize statement at the
beginning of the procedure.
My formula is Int ( 10 * Rnd + 1 ) to get a number between 1 and 10.

Thing is I have been trying this formula on 30 * 65536 cells and for each
session I get a 6.11 average. Most of the time it changes after the third
figure (like 6.114 instead of 6.112) but I am very surprised by the
similarity of the results...

Is that supposed to happen or am I doing something wrong?

Thanks
T_D
 
O

OssieMac

With that number of random samples approximately the same number of each
number 1 to 10 would always be produced with a random number generator. (The
law of probability). Use the Countif function to count the number of
occurrences of each number and you will find that you have almost equal
occurrences of each number 1 to 10.

Worksheet function example counts the number of occurrences of 1.
=COUNTIF($A$1:$AD$65536,1)
Change the parameter 1 to 2, 3, 4 etc for the other numbers.

However, what does surprise me is your end average result. I don’t think
that is the correct average of that number of random samples from 1 to 10.
The average of the numbers 1 to 10 is 5.5 and I would expect something
similar for a large number of random numbers between 1 and 10.
 
R

RB Smissaert

Average should alway be close to 5.5, that is (10 + 1) / 2.
The more you do the closer you get.
So, you are doing something wrong to get 6.11 or similar.
Are you not doing CLng (in VBA) instead of Int?
Due to the rounding that would give you your average figures.

RBS
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top