> I generated 20,000 numbers in the range 0..255 and wrote each byte to a
> binary file. Then analyzed it with this program:
>
> http://www.fourmilab.ch/random/
>
> I ran the sametestagainst the Delphi RandomRange function:
>
> F:\>ent.exe rand.bin
> Entropy = 7.991116 bits per byte.
>
> Optimum compression would reduce the size
> of this 20000 byte file by 0 percent.
>
> Chi square distribution for 20000 samples is 246.52, and randomly
> would exceed this value 50.00 percent of the times.
>
> Arithmetic mean value of data bytes is 126.9546 (127.5 = random).
> Monte Carlo value for Pi is 3.146714671 (error 0.16 percent).
> Serial correlation coefficient is -0.010652 (totally uncorrelated = 0.0).
>
Hello,
I'm comparing my own Random Number generator (using Mersenne Twister
Algorithm) with the Microsoft C# 's Random.Next function to see which
one is better.
In my comparison, I've them both produce 20,000 integer numbers(32
bits) range from 0 -255, which exactly like what you do, and run the
Went(a variant to the Original Ent) program against both of them.
For C#'s Random object:
Entropy = 0.541372 bits per bit.
Optimum compression would reduce the size of this 640000 bit file by
45 percent.
Chi square distribution for 640000 samples is 361498.56, and randomly
would exceed this value 0.01 percent of the times.
Arithmetic mean value of data bits is 0.1242 (0.5 = random).
Monte Carlo value for Pi is 4.000000000 (error 27.32 percent).
Serial correlation coefficient is 0.354847 (totally uncorrelated =
0.0).
For my own RNG:
Entropy = 0.542954 bits per bit.
Optimum compression would reduce the size of this 640000 bit file by
45 percent.
Chi square distribution for 640000 samples is 360417.12, and randomly
would exceed this value 0.01 percent of the times.
Arithmetic mean value of data bits is 0.1248 (0.5 = random).
Monte Carlo value for Pi is 4.000000000 (error 27.32 percent).
Serial correlation coefficient is 0.355082 (totally uncorrelated =
0.0).
It look very bad for both of them.
Am I doing something wrong with the generated number?
The number was produce and wrote to binary file using the following
code:
FileStream fs = new FileStream(path, FileMode.Append);
// Create the writer for data.
BinaryWriter w = new BinaryWriter(fs);
// Write data to Test.data.
for (int i = 0; i < 20000; i++)
{
w.Write(RandomHelperNew.SmallInt(0,255,false));//my own RNG
}
w.Close();
fs.Close();
Do you need to format your 32 bits integers(convert them into byte
array?) before you write them to binary file?
About the Ent test program, There are several options we could chose
from. Can you please give an example (the command you enter for your
test)?