Originally this was a complex class to make random numbers better than the Random class.. then it as found there exists a class already in .NET which creates random bytes just as well if not better in the security namespace, one downside is that it only makes bytes. So the new version of this class uses the security RNG to make effective random numbers in the same way you would use the normal Random class
Enjoy
Last edited by Phill64; Mar 3rd, 2006 at 04:27 AM.
AntRush - Real-Time Strategy game, based around ants!
Phill64,
Thanks for your nice and compact generator.
I ran the following code some times:
Dim d = 0.0, RNG = New TrueRandom2
For i = 1 To 10 ^ 6
d += RNG.GetDouble()
Next
d /= 10 ^ 6
Debug.Print(d.ToString)
The results were as below:
0.493309032617664
0.49317274406027
0.49305896922429
0.493589299245047
0.493577591414951
I would have expected closer to 0.5, is this on purpose?