random: add a commented-out test i used to run ENT

https://www.fourmilab.ch/random/

Entropy = 8.000000 bits per byte.

Optimum compression would reduce the size
of this 912444480 byte file by 0 percent.

Chi square distribution for 912444480 samples is 254.09, and randomly
would exceed this value 50.43 percent of the times.

Arithmetic mean value of data bytes is 127.4952 (127.5 = random).
Monte Carlo value for Pi is 3.141641048 (error 0.00 percent).
Serial correlation coefficient is 0.000022 (totally uncorrelated = 0.0).
This commit is contained in:
Antoine Poinsot 2023-02-14 17:39:40 +01:00
parent 157eea9893
commit 20f394a452
No known key found for this signature in database
GPG Key ID: E13FC145CD3F4304

View File

@ -109,4 +109,20 @@ mod tests {
set.insert(rand);
}
}
// I used this to perform statistical tests of the random generation function using ENT
// (https://fourmilab.ch/random/).
//#[test]
//fn write_to_file() {
//use std::io::Write;
//let mut f = std::fs::OpenOptions::new()
//.write(true)
//.create(true)
//.append(true)
//.open("random_out")
//.unwrap();
//for _ in 0..10_000_000 {
//f.write(&random_bytes().unwrap()).unwrap();
//}
//}
}