C# Class numl.Math.Probability.Sampling

SimpleRNG is a simple random number generator based on George Marsaglia's MWC (multiply with carry) generator. Although it is very simple, it passes Marsaglia's DIEHARD series of random number generator tests. Written by John D. Cook http://www.johndcook.com.
Afficher le fichier Open project: sethjuarez/numl Class Usage Examples

Méthodes publiques

Méthode Description
GetBeta ( double a, double b ) : double

Gets a beta.

GetCauchy ( double median, double scale ) : double

Gets a cauchy.

GetChiSquare ( double degreesOfFreedom ) : double

Gets chi square.

GetExponential ( ) : double

Exponential random sample with mean 1.

GetExponential ( double mean ) : double

Exponential random sample with specified mean.

GetGamma ( double shape, double scale ) : double

Gets a gamma.

GetInverseGamma ( double shape, double scale ) : double

Gets inverse gamma.

GetLaplace ( double mean, double scale ) : double

The Laplace distribution is also known as the double exponential distribution.

GetLogNormal ( double mu, double sigma ) : double

Gets log normal.

GetNormal ( ) : double

Normal (Gaussian) random sample with mean 0 and standard deviation 1.

GetNormal ( double mean, double standardDeviation ) : double

Normal (Gaussian) random sample with specified mean and standard deviation.

GetPower ( double a, double min = 1 ) : double

Gets a power.

GetStudentT ( double degreesOfFreedom ) : double

Gets student.

GetUniform ( ) : double

Produce a uniform random sample from the open interval (0, 1). The method will not return either end point.

GetUniform ( double min = 0d, double max = 1.0d ) : double

Produce a uniform random sample from the open interval (min, max inclusive). The method can return either end point

GetUniform ( int max ) : int

Produce a uniform random sample from the open interval (0, max). The method will not return either end point.

GetUniform ( int min, int max ) : int

Produce a uniform random sample from the open interval (min, max). The method can return either end point.

GetWeibull ( double shape, double scale ) : double

Gets a weibull.

SetSeedFromSystemTime ( ) : void

Creates random number generator seed.

SetSeedFromTime ( System.DateTime dt ) : void

Set random seed from a specified time

Private Methods

Méthode Description
GetUint ( ) : uint

This is the heart of the generator. It uses George Marsaglia's MWC algorithm to produce an unsigned integer. See http://www.bobwheeler.com/statistics/Password/MarsagliaPost.txt.

Sampling ( ) : System

Static constructor.

SetSeed ( uint u ) : void

Sets a seed.

SetSeed ( uint u, uint v ) : void

The random generator seed can be set three ways: 1) specifying two non-zero unsigned integers 2) specifying one non-zero unsigned integer and taking a default value for the second 3) setting the seed from the system time.

Method Details

GetBeta() public static méthode

Gets a beta.
Thrown when one or more arguments are outside the /// required range.
public static GetBeta ( double a, double b ) : double
a double The double to process.
b double The double to process.
Résultat double

GetCauchy() public static méthode

Gets a cauchy.
Thrown when one or more arguments have unsupported or /// illegal values.
public static GetCauchy ( double median, double scale ) : double
median double The median.
scale double The scale.
Résultat double

GetChiSquare() public static méthode

Gets chi square.
public static GetChiSquare ( double degreesOfFreedom ) : double
degreesOfFreedom double The degrees of freedom.
Résultat double

GetExponential() public static méthode

Exponential random sample with mean 1.
public static GetExponential ( ) : double
Résultat double

GetExponential() public static méthode

Exponential random sample with specified mean.
Thrown when one or more arguments are outside the /// required range.
public static GetExponential ( double mean ) : double
mean double mean parameter.
Résultat double

GetGamma() public static méthode

Gets a gamma.
Thrown when one or more arguments are outside the /// required range.
public static GetGamma ( double shape, double scale ) : double
shape double The shape.
scale double The scale.
Résultat double

GetInverseGamma() public static méthode

Gets inverse gamma.
public static GetInverseGamma ( double shape, double scale ) : double
shape double The shape.
scale double The scale.
Résultat double

GetLaplace() public static méthode

The Laplace distribution is also known as the double exponential distribution.
public static GetLaplace ( double mean, double scale ) : double
mean double Mean.
scale double The scale.
Résultat double

GetLogNormal() public static méthode

Gets log normal.
public static GetLogNormal ( double mu, double sigma ) : double
mu double The mu.
sigma double The sigma.
Résultat double

GetNormal() public static méthode

Normal (Gaussian) random sample with mean 0 and standard deviation 1.
public static GetNormal ( ) : double
Résultat double

GetNormal() public static méthode

Normal (Gaussian) random sample with specified mean and standard deviation.
Thrown when one or more arguments are outside the /// required range.
public static GetNormal ( double mean, double standardDeviation ) : double
mean double Mean.
standardDeviation double Standard deviation.
Résultat double

GetPower() public static méthode

Gets a power.
public static GetPower ( double a, double min = 1 ) : double
a double The double to process.
min double (Optional) Min (exclusive)
Résultat double

GetStudentT() public static méthode

Gets student.
Thrown when one or more arguments have unsupported or /// illegal values.
public static GetStudentT ( double degreesOfFreedom ) : double
degreesOfFreedom double The degrees of freedom.
Résultat double

GetUniform() public static méthode

Produce a uniform random sample from the open interval (0, 1). The method will not return either end point.
public static GetUniform ( ) : double
Résultat double

GetUniform() public static méthode

Produce a uniform random sample from the open interval (min, max inclusive). The method can return either end point
public static GetUniform ( double min = 0d, double max = 1.0d ) : double
min double
max double
Résultat double

GetUniform() public static méthode

Produce a uniform random sample from the open interval (0, max). The method will not return either end point.
public static GetUniform ( int max ) : int
max int Max (Exclusive)
Résultat int

GetUniform() public static méthode

Produce a uniform random sample from the open interval (min, max). The method can return either end point.
public static GetUniform ( int min, int max ) : int
min int Min (exclusive)
max int Max (exclusive)
Résultat int

GetWeibull() public static méthode

Gets a weibull.
Thrown when one or more arguments are outside the /// required range.
public static GetWeibull ( double shape, double scale ) : double
shape double The shape.
scale double The scale.
Résultat double

SetSeedFromSystemTime() public static méthode

Creates random number generator seed.
public static SetSeedFromSystemTime ( ) : void
Résultat void

SetSeedFromTime() public static méthode

Set random seed from a specified time
public static SetSeedFromTime ( System.DateTime dt ) : void
dt System.DateTime date time
Résultat void