C# Class Microsoft.HockeyApp.Extensibility.Implementation.WeakConcurrentRandom

Random generator creating “sufficiently random” integers, which is faster than to initializes a new instance of the GUID structure, and uses 8 bytes only for the id instead of 16.
显示文件 Open project: bitstadium/HockeySDK-Windows Class Usage Examples

Public Methods

Method Description
Initialize ( ) : void

Initializes generator with a set of random numbers.

Initialize ( IRandomNumberBatchGenerator>.Func randomGeneratorFactory, int segmentIndexBits, int segmentBits ) : void

Initializes generator with a set of random numbers.

Next ( ) : ulong

Weakly thread safe next (random) operation id generator where 'weakly' indicates that it is unlikely we'll get into collision state.

WeakConcurrentRandom ( ) : System

Initializes a new instance of the WeakConcurrentRandom class.

Private Methods

Method Description
RegenerateSegment ( int newIndex ) : void

Generates random number batch for segment which just exhausted according to value of the new index.

Method Details

Initialize() public method

Initializes generator with a set of random numbers.
public Initialize ( ) : void
return void

Initialize() public method

Initializes generator with a set of random numbers.
public Initialize ( IRandomNumberBatchGenerator>.Func randomGeneratorFactory, int segmentIndexBits, int segmentBits ) : void
randomGeneratorFactory IRandomNumberBatchGenerator>.Func Factory used to create random number batch generators.
segmentIndexBits int Number of significant bits in segment index, i.e. value of 3 means 8 segments of random numbers - 0..7.
segmentBits int Number of significant bits in random number index within segment, i.e. value of 10 means 1024 random numbers per segment.
return void

Next() public method

Weakly thread safe next (random) operation id generator where 'weakly' indicates that it is unlikely we'll get into collision state.
public Next ( ) : ulong
return ulong

WeakConcurrentRandom() public method

Initializes a new instance of the WeakConcurrentRandom class.
public WeakConcurrentRandom ( ) : System
return System