C# 클래스 Encog.MathUtil.LinearCongruentialGenerator

A predictable random number generator. This is useful for unit tests and benchmarks where we want random numbers, but we want them to be the same each time. This class exists on both Java and C# so it can even provide consistent random numbers over the two platforms. Random numbers are created using a LCG. http://en.wikipedia.org/wiki/Linear_congruential_generator
파일 보기 프로젝트 열기: encog/encog-silverlight-core 1 사용 예제들

공개 메소드들

메소드 설명
LinearCongruentialGenerator ( long seed ) : System

Construct the default LCG. You need only specify a seed.

LinearCongruentialGenerator ( long modulus, long multiplier, long increment, long seed ) : System

Create a LCG with the specified modulus, multiplier and increment. Unless you REALLY KNOW WHAT YOU ARE DOING, just use the constructor that just takes a seed. It will set these values to the same as set by the GCC C compiler. Setting these values wrong can create fairly useless random numbers.

NextDouble ( ) : double

The next random number as a double between 0 and 1.

NextLong ( ) : long

The next random number as a long between 0 and MAX_RAND.

Range ( double min, double max ) : double

Generate a random number in the specified range.

메소드 상세

LinearCongruentialGenerator() 공개 메소드

Construct the default LCG. You need only specify a seed.
public LinearCongruentialGenerator ( long seed ) : System
seed long The seed.
리턴 System

LinearCongruentialGenerator() 공개 메소드

Create a LCG with the specified modulus, multiplier and increment. Unless you REALLY KNOW WHAT YOU ARE DOING, just use the constructor that just takes a seed. It will set these values to the same as set by the GCC C compiler. Setting these values wrong can create fairly useless random numbers.
public LinearCongruentialGenerator ( long modulus, long multiplier, long increment, long seed ) : System
modulus long The modulus for the LCG algorithm.
multiplier long The multiplier for the LCG algorithm.
increment long The increment for the LCG algorithm.
seed long The seed for the LCG algorithm. Using the same seed will give /// the same random number sequence each time, whether in Java or /// DotNet.
리턴 System

NextDouble() 공개 메소드

The next random number as a double between 0 and 1.
public NextDouble ( ) : double
리턴 double

NextLong() 공개 메소드

The next random number as a long between 0 and MAX_RAND.
public NextLong ( ) : long
리턴 long

Range() 공개 메소드

Generate a random number in the specified range.
public Range ( double min, double max ) : double
min double The minimum random number.
max double The maximum random number.
리턴 double