C# Class RandomOps.RandomDotOrg

Random Number Generator (RNG) that downloads random bytes from the internet website: www.random.org. Not thread-safe. These random bytes are generated from atmospheric noise picked up by radios. Only a certain number of bits are allowed to be downloaded from this website to your IP address each day, so this RNG is used with a Fallback-PRNG.
Inheritance: ByteStream
Mostra file Open project: DanWBR/dwsim3 Class Usage Examples

Public Methods

Method Description
RandomDotOrg ( int bufferSize, Random randFallback, int numFallback ) : System.Collections.Generic

Constructs the RNG-object.

RetrieveBytes ( int length ) : List

Do the actual retrieval of random bytes from the www.random.org website.

Protected Methods

Method Description
DoFillBuffer ( int length ) : void

Called from ByteStream to request the retrieval of random bytes.

Method Details

DoFillBuffer() protected final method

Called from ByteStream to request the retrieval of random bytes.
protected final DoFillBuffer ( int length ) : void
length int The number of bytes requested.
return void

RandomDotOrg() public method

Constructs the RNG-object.
public RandomDotOrg ( int bufferSize, Random randFallback, int numFallback ) : System.Collections.Generic
bufferSize int Number of random bytes the buffer holds.
randFallback Random Fallback RNG to be used when buffer is empty.
numFallback int Use fallback RNG for this many bytes before trying to fill buffer again.
return System.Collections.Generic

RetrieveBytes() public static method

Do the actual retrieval of random bytes from the www.random.org website.
/// Thrown if daily download quota is depleted, /// the HTTP response code is 503 for 'Server Unavailable'. ///
public static RetrieveBytes ( int length ) : List
length int Number of bytes to retrieve (max 10000).
return List