Link to home
Start Free TrialLog in
Avatar of Zentric
Zentric

asked on

Random Numbers Broken?

Hi, after trying diffrent things like Microsoft excal and so on.
I have come to the conclution that my computer system does not not give me accurate random numbers. After extremely long test series i get 47,6 not 50
from 1-100 tests. Is my processor broken?

How i did the tests.
(windows Xp, MS excel xp)

create new sheet.(row A) =Random
About 300 lines of that
RoW B(=RowA*100))
Summ and divide by 300
regerated that page about 40 times
Wrote down all results and made the calulations (results / tests)
Repeted that 25 times.

300 * 40 *25 = 300 000 tests

My system Intel P4 2600/800 Asus P4p800 Mb
Avatar of d-glitch
d-glitch
Flag of United States of America image

Your processor is certainly not broken.
Perhaps the Random number generator in Excel is not the best.

More likely the problem may be in the way you are testing it:

     You said  "About 300 lines of that"
     You better make sure that you are summing exactly 300 random numbers if you are dividing by 300.

I think the Excel Random number generator is fine.

I do think the problem is in the way you are doing your test.

I added up 4 colomns of  50,000 cells of   [ =rand()*100] and  divided by 50,000 and got these averages:

     50.09514821      50.06182015      49.98193983      49.95743114
The Excel random number generator is known to have problems that one should be aware of when using it: http://office-watch.com/office2003/archtemplate.asp?1-n11
ASKER CERTIFIED SOLUTION
Avatar of d-glitch
d-glitch
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
That should be:
                         =max(A1:T5000)             ==>  you should get very close to 99.99
                         =min(A1:T5000)              ==>  you should get very close to   0.01

Callandor may be correct.

I am running Excel 2002, which predates the problem from Callandor's post.

The     =min(A1:T5000)  test would be the one to run to catch negative numbers.
Avatar of Zentric
Zentric

ASKER

d-glitch

thx for reedback
I tested it and yes it gives those numbers
i did not try max and min (it crashes XL)
But i get very near 50

there is nothing wrong whit my test at all.
And further testing shows that the problem shows upp when you grab few numbers.

If i grab 10 numbers in a slow pace -i will get around 47,6
I have teste this 40 to 50 times i allways gives that

I have second computer (p4 to) and i will have this one as a reference.
But i can tell u it generates numbers alot higher. (tried)

I have noticed that when u crank upp the generation rate, i gett better numbers.
i will create a c program that generates 1 random number a second and lett i run for 2 hours. That is my next project

I will keep u posted, of my findings.

If you are concerned about the cpu, you can run Prime95 on it and it will heavily exercise your cpu.  If it generates wrong values, the program will stop.
 You should not expect good Algorithm generated pseudo-random numbers from Excel anyway.

  Computer generated random numbers are not perfect and are known to repeat after a few milion times. Unless you are using some prorietary RSA Algorithm and a really good seed, computer random is not random, it is pseudo random and well you should not expect 50% from a random number anyway. The best random number will ever get is a phisical random number...

  There is this famous story, funny but true. http://www.wired.com/wired/archive/11.08/random.html 

  "Random numbers should not be generated with a method chosen at random." —Donald E. Knuth

So, sit back relax and enjoy the randomness you can get from Excell. If you need better random numbers, don't use excel! You can always use http://www.lavarnd.org/ 

Cheers !
-Mark
Well what I mean is that Even if you are using some top notch RSA Algorithm and a really good seed, computer generated numbers are, well, generated. They are not really random. That's why they are called pseudo-random.