Show / Hide Table of Contents

Class 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.

Inheritance
System.Object
Sampling
Inherited Members
System.Object.Equals(System.Object)
System.Object.Equals(System.Object, System.Object)
System.Object.GetHashCode()
System.Object.GetType()
System.Object.MemberwiseClone()
System.Object.ReferenceEquals(System.Object, System.Object)
System.Object.ToString()
Namespace:numl.Math.Probability
Assembly:numl.dll
Syntax
public class Sampling

Methods

View Source

GetBeta(Double, Double)

Gets a beta.

Declaration
public static double GetBeta(double a, double b)
Parameters
Type Name Description
System.Double a

The double to process.

System.Double b

The double to process.

Returns
Type Description
System.Double

The beta.

Exceptions
Type Condition
System.ArgumentOutOfRangeException

Thrown when one or more arguments are outside the required range.

View Source

GetCauchy(Double, Double)

Gets a cauchy.

Declaration
public static double GetCauchy(double median, double scale)
Parameters
Type Name Description
System.Double median

The median.

System.Double scale

The scale.

Returns
Type Description
System.Double

The cauchy.

Exceptions
Type Condition
System.ArgumentException

Thrown when one or more arguments have unsupported or illegal values.

View Source

GetChiSquare(Double)

Gets chi square.

Declaration
public static double GetChiSquare(double degreesOfFreedom)
Parameters
Type Name Description
System.Double degreesOfFreedom

The degrees of freedom.

Returns
Type Description
System.Double

The chi square.

View Source

GetExponential()

Exponential random sample with mean 1.

Declaration
public static double GetExponential()
Returns
Type Description
System.Double

Random Sample.

View Source

GetExponential(Double)

Exponential random sample with specified mean.

Declaration
public static double GetExponential(double mean)
Parameters
Type Name Description
System.Double mean

mean parameter.

Returns
Type Description
System.Double

Random Sample.

Exceptions
Type Condition
System.ArgumentOutOfRangeException

Thrown when one or more arguments are outside the required range.

View Source

GetGamma(Double, Double)

Gets a gamma.

Declaration
public static double GetGamma(double shape, double scale)
Parameters
Type Name Description
System.Double shape

The shape.

System.Double scale

The scale.

Returns
Type Description
System.Double

The gamma.

Exceptions
Type Condition
System.ArgumentOutOfRangeException

Thrown when one or more arguments are outside the required range.

View Source

GetInverseGamma(Double, Double)

Gets inverse gamma.

Declaration
public static double GetInverseGamma(double shape, double scale)
Parameters
Type Name Description
System.Double shape

The shape.

System.Double scale

The scale.

Returns
Type Description
System.Double

The inverse gamma.

View Source

GetLaplace(Double, Double)

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

Declaration
public static double GetLaplace(double mean, double scale)
Parameters
Type Name Description
System.Double mean

Mean.

System.Double scale

The scale.

Returns
Type Description
System.Double

The laplace.

View Source

GetLogNormal(Double, Double)

Gets log normal.

Declaration
public static double GetLogNormal(double mu, double sigma)
Parameters
Type Name Description
System.Double mu

The mu.

System.Double sigma

The sigma.

Returns
Type Description
System.Double

The log normal.

View Source

GetNormal()

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

Declaration
public static double GetNormal()
Returns
Type Description
System.Double

Random Sample.

View Source

GetNormal(Double, Double)

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

Declaration
public static double GetNormal(double mean, double standardDeviation)
Parameters
Type Name Description
System.Double mean

Mean.

System.Double standardDeviation

Standard deviation.

Returns
Type Description
System.Double

Random Sample.

Exceptions
Type Condition
System.ArgumentOutOfRangeException

Thrown when one or more arguments are outside the required range.

View Source

GetPower(Double, Double)

Gets a power.

Declaration
public static double GetPower(double a, double min = 1)
Parameters
Type Name Description
System.Double a

The double to process.

System.Double min

(Optional) Min (exclusive)

Returns
Type Description
System.Double

The power.

View Source

GetStudentT(Double)

Gets student.

Declaration
public static double GetStudentT(double degreesOfFreedom)
Parameters
Type Name Description
System.Double degreesOfFreedom

The degrees of freedom.

Returns
Type Description
System.Double

The student.

Exceptions
Type Condition
System.ArgumentException

Thrown when one or more arguments have unsupported or illegal values.

View Source

GetUniform()

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

Declaration
public static double GetUniform()
Returns
Type Description
System.Double

Random Sample.

View Source

GetUniform(Double, Double)

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

Declaration
public static double GetUniform(double min = 0, double max = 1)
Parameters
Type Name Description
System.Double min
System.Double max
Returns
Type Description
System.Double
View Source

GetUniform(Int32)

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

Declaration
public static int GetUniform(int max)
Parameters
Type Name Description
System.Int32 max

Max (Exclusive)

Returns
Type Description
System.Int32

Random Sample.

View Source

GetUniform(Int32, Int32)

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

Declaration
public static int GetUniform(int min, int max)
Parameters
Type Name Description
System.Int32 min

Min (exclusive)

System.Int32 max

Max (exclusive)

Returns
Type Description
System.Int32

Random Sample.

View Source

GetWeibull(Double, Double)

Gets a weibull.

Declaration
public static double GetWeibull(double shape, double scale)
Parameters
Type Name Description
System.Double shape

The shape.

System.Double scale

The scale.

Returns
Type Description
System.Double

The weibull.

Exceptions
Type Condition
System.ArgumentOutOfRangeException

Thrown when one or more arguments are outside the required range.

View Source

SetSeedFromSystemTime()

Creates random number generator seed.

Declaration
public static void SetSeedFromSystemTime()
View Source

SetSeedFromTime(DateTime)

Set random seed from a specified time

Declaration
public static void SetSeedFromTime(DateTime dt)
Parameters
Type Name Description
System.DateTime dt

date time

  • View Source
©2017 — Seth Juarez
numl v0.9.20-beta
MIT License
docs by docfx