C# 클래스 RandomOps.RandomDotOrgAsync

Similar to the RandomDotOrg-class, only this uses asynchronous retrieval of the random bytes, which is preferrable in time-critical applications. If bytes are not available in the downloaded buffer, then a thread is woken up to fill the buffer. In the meantime a Fallback RNG is used instead. Not thread-safe.
Be sure to call Dispose() after you are done using this RNG, so the worker-thread can be shut down properly. Also note that this class is not thread-safe with regard to multiple threads calling e.g. the Uniform() method simultaneously. To make it thread-safe in this manner, wrap it in a ThreadSafe-object.
상속: ByteStreamAsync
파일 보기 프로젝트 열기: DanWBR/dwsim3

공개 메소드들

메소드 설명
RandomDotOrgAsync ( int bufferSize, int retrieveTrigger, Random randFallback, int numFallback ) : System.Collections.Generic

Constructs the RNG-object.

보호된 메소드들

메소드 설명
DoFillBuffer ( int length ) : void

Called from ByteStream to request the retrieval of random bytes.

메소드 상세

DoFillBuffer() 보호된 최종 메소드

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

RandomDotOrgAsync() 공개 메소드

Constructs the RNG-object.
public RandomDotOrgAsync ( int bufferSize, int retrieveTrigger, Random randFallback, int numFallback ) : System.Collections.Generic
bufferSize int Number of random bytes the buffer holds.
retrieveTrigger int Refill buffer asynchronously when its size falls below this.
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.
리턴 System.Collections.Generic