Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Always the same average for random numbers!?
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 |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Always the same average for random numbers!?
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 dont 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. -- Regards, OssieMac |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Always the same average for random numbers!?
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 "The Dude" <f_com2°AT°yahoo°DOT°fr wrote in message ... 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 |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
How to average random cells with out counting zero? | Excel Worksheet Functions | |||
getting numbers divisible by 4 from random numbers in ascending order | Excel Worksheet Functions | |||
Can Excel pick random numbers from 1-300 and not repeat numbers? | Excel Discussion (Misc queries) | |||
Non-random numbers generated by excel's data analysis random gener | Excel Worksheet Functions | |||
Non-random numbers generated by excel's data analysis random gener | Excel Discussion (Misc queries) |