1 Attachment(s)
"True Random" Number Generator (Mark II)
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
Re: "True Random" Number Generator (Mark II)
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?