Results 1 to 2 of 2

Thread: "True Random" Number Generator (Mark II)

Hybrid View

  1. #1

    Thread Starter
    Frenzied Member Phill64's Avatar
    Join Date
    Jul 2005
    Location
    Queensland, Australia
    Posts
    1,201

    "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
    Attached Files Attached Files
    Last edited by Phill64; Mar 3rd, 2006 at 04:27 AM.

  2. #2
    New Member
    Join Date
    Oct 2013
    Posts
    1

    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?

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width