[galib] Random Numbers (randtest)

Jordi Verdiell Cubedo verdiell at guest.uji.es
Tue May 2 06:48:20 EDT 2006


Hi to all. 

I have an irregular results when i'm running my programs with Galib, and i
thinks that is a problem with random numbers. Hi've tested random numbers with
the example randtest and i don't know how to evaluate the results given by
randtest. Is the random number generator running well in my computer? I post
some of the results I've obtained:

integer test (1000):  chi-squared should be within 20 of 100
    run #0      111.2
    run #1      98.72
    run #2      94.672
    run #3      120.267 ***failed***
    run #4      99.0267
    run #5      126.303 ***failed***
    run #6      89.6303
    run #7      99.563
    run #8      97.9563
    run #9      107.396
  integer test (10000)...
  integer test (10000):  chi-squared should be within 20 of 100
    run #0      98.02
    run #1      99.44
    run #2      109.46
    run #3      88.84
    run #4      77.92   ***failed***
    run #5      95.86
    run #6      79.66   ***failed***
    run #7      84.08
    run #8      124.92  ***failed***
    run #9      87.98
  integer test (10000)...
  integer test (10000):  chi-squared should be within 20 of 100
    run #0      107.36
    run #1      106.28
    run #2      108.62
    run #3      85.3
    run #4      108.5
    run #5      78.24   ***failed***
    run #6      117.02
    run #7      91.38
    run #8      109.82
    run #9      117.7
  integer test (100000)...
  integer test (100000):  chi-squared should be within 20 of 100
    run #0      89.874
    run #1      93.018
    run #2      109.396
    run #3      98.156
    run #4      105.7
    run #5      120.898 ***failed***
    run #6      97.192
    run #7      106.964
    run #8      146.844 ***failed***
    run #9      90.334

And then I run the means test, let's see some results:

heck for averages of repeated biased coin tosses...
10000 calls to GARandomBit()            4978 hits (should be about 5000)
10000 calls to GARandomInt()            0.505 (should be about 0.5)
10000 calls to GARandomInt(0,5)         2.4739 (should be about 2.5)
10000 calls to GARandomFloat()          0.500314 (should be about 0.5)
10000 calls to GARandomFloat(0,5)       2.50675 (should be about 2.5)
10000 calls to GARandomFloat(-10,-5)    -7.47479 (should be about -7.5)
10000 calls to GARandomFloat(-10,10)    0.0406843 (should be about 0.0)
10000 calls to GARandomDouble()         0.498228 (should be about 0.5)
10000 calls to GARandomDouble(0,2)      1.00317 (should be about 1.0)
10000 calls to GARandomDouble(0,5)      2.48973 (should be about 2.5)
10000 calls to GARandomDouble(-10,-5)   -7.49419 (should be about -7.5)
10000 calls to GARandomDouble(-10,10)   0.0298172 (should be about 0.0)

[0, 1] with GARandomFloat()...          0.478294 0.415164 0.462413
[0, 1] with GARandomFloat(0,1)...       0.521988 0.54285 0.551539
[0, 100] with GARandomFloat(0,100)...   45.6837 54.091 47.9849
[0, 1] with GARandomDouble()...         0.464149 0.501558 0.501285
[0, 1] with GARandomDouble(0,1)...      0.561997 0.517761 0.473783
[0, 100] with GARandomDouble(0,100)...  52.5523 43.5019 48.3415

1% coin flip...         0.0103 0.01 0.0098
25% coin flip...        0.2532 0.2531 0.2472
50% coin flip...        0.4951 0.5004 0.4915
75% coin flip...        0.7489 0.7463 0.7545
99% coin flip...        0.9916 0.9895 0.9882

calls to GARandomBit (these should yield 50%)...
0.4947 0.4972 0.4925


Are this values correct? 
Thanks to all.




More information about the galib mailing list