RandomSamplingExtensions.Next Method

Definition

Namespace: Numerics.NET.Statistics.Distributions
Assembly: Numerics.NET (in Numerics.NET.dll) Version: 10.3.0

Overload List

Next(IRandomSource, ContinuousDistribution) Generates a random sample from the specified continuous distribution.
Next(IRandomSource, DiscreteDistribution) Generates a random sample from the specified discrete distribution.
Next(Random, DiscreteDistribution) Generates a random sample from the specified discrete distribution.
Next(IRandomSource, ContinuousDistribution, Int32) Generates an array of random samples from the specified continuous distribution.
Next(IRandomSource, DiscreteDistribution, Int32) Generates an array of random samples from the specified discrete distribution.
Next(Random, ContinuousDistribution, Int32) Generates an array of random samples from the specified continuous distribution.
Next(Random, DiscreteDistribution, Int32) Generates an array of random samples from the specified discrete distribution.
Next<TGenerator>(IRandomSource<TGenerator>, ContinuousDistribution) Generates a random sample from the specified continuous distribution.
Next<TGenerator>(IRandomSource<TGenerator>, DiscreteDistribution) Generates a random sample from the specified discrete distribution.
Next<TGenerator>(IRandomSource<TGenerator>, ContinuousDistribution, Int32) Generates an array of random samples from the specified continuous distribution.
Next<TGenerator>(IRandomSource<TGenerator>, DiscreteDistribution, Int32) Generates an array of random samples from the specified discrete distribution.

Next(IRandomSource, ContinuousDistribution)

Generates a random sample from the specified continuous distribution.
C#
public static double Next(
	this IRandomSource random,
	ContinuousDistribution distribution
)

Parameters

random  IRandomSource
 
distribution  ContinuousDistribution
The probability distribution to sample from.

Return Value

Double
A random sample from the distribution.

Usage Note

In Visual Basic and C#, you can call this method as an instance method on any object of type IRandomSource. When you use instance method syntax to call this method, omit the first parameter. For more information, see Extension Methods (Visual Basic) or Extension Methods (C# Programming Guide).

Next(IRandomSource, DiscreteDistribution)

Generates a random sample from the specified discrete distribution.
C#
public static int Next(
	this IRandomSource random,
	DiscreteDistribution distribution
)

Parameters

random  IRandomSource
 
distribution  DiscreteDistribution
The probability distribution to sample from.

Return Value

Int32
A random sample from the distribution.

Usage Note

In Visual Basic and C#, you can call this method as an instance method on any object of type IRandomSource. When you use instance method syntax to call this method, omit the first parameter. For more information, see Extension Methods (Visual Basic) or Extension Methods (C# Programming Guide).

Next<TGenerator>(IRandomSource<TGenerator>, ContinuousDistribution)

Generates a random sample from the specified continuous distribution.
C#
public static double Next<TGenerator>(
	this IRandomSource<TGenerator> random,
	ContinuousDistribution distribution
)
where TGenerator : struct, new(), IRandomGenerator

Parameters

random  IRandomSource<TGenerator>
 
distribution  ContinuousDistribution
The probability distribution to sample from.

Type Parameters

TGenerator

Return Value

Double
A random sample from the distribution.

Usage Note

In Visual Basic and C#, you can call this method as an instance method on any object of type IRandomSource<TGenerator>. When you use instance method syntax to call this method, omit the first parameter. For more information, see Extension Methods (Visual Basic) or Extension Methods (C# Programming Guide).

Next<TGenerator>(IRandomSource<TGenerator>, DiscreteDistribution)

Generates a random sample from the specified discrete distribution.
C#
public static int Next<TGenerator>(
	this IRandomSource<TGenerator> random,
	DiscreteDistribution distribution
)
where TGenerator : struct, new(), IRandomGenerator

Parameters

random  IRandomSource<TGenerator>
 
distribution  DiscreteDistribution
The probability distribution to sample from.

Type Parameters

TGenerator

Return Value

Int32
A random sample from the distribution.

Usage Note

In Visual Basic and C#, you can call this method as an instance method on any object of type IRandomSource<TGenerator>. When you use instance method syntax to call this method, omit the first parameter. For more information, see Extension Methods (Visual Basic) or Extension Methods (C# Programming Guide).

Next(Random, DiscreteDistribution)

Generates a random sample from the specified discrete distribution.
C#
public static int Next(
	this Random random,
	DiscreteDistribution distribution
)

Parameters

random  Random
 
distribution  DiscreteDistribution
The probability distribution to sample from.

Return Value

Int32
A random sample from the distribution.

Usage Note

In Visual Basic and C#, you can call this method as an instance method on any object of type Random. When you use instance method syntax to call this method, omit the first parameter. For more information, see Extension Methods (Visual Basic) or Extension Methods (C# Programming Guide).

Next(IRandomSource, ContinuousDistribution, Int32)

Generates an array of random samples from the specified continuous distribution.
C#
public static double[] Next(
	this IRandomSource random,
	ContinuousDistribution distribution,
	int count
)

Parameters

random  IRandomSource
 
distribution  ContinuousDistribution
The probability distribution to sample from.
count  Int32
The number of samples to generate.

Return Value

Double[]
An array of random samples from the distribution.

Usage Note

In Visual Basic and C#, you can call this method as an instance method on any object of type IRandomSource. When you use instance method syntax to call this method, omit the first parameter. For more information, see Extension Methods (Visual Basic) or Extension Methods (C# Programming Guide).

Next(IRandomSource, DiscreteDistribution, Int32)

Generates an array of random samples from the specified discrete distribution.
C#
public static int[] Next(
	this IRandomSource random,
	DiscreteDistribution distribution,
	int count
)

Parameters

random  IRandomSource
 
distribution  DiscreteDistribution
The probability distribution to sample from.
count  Int32
The number of samples to generate.

Return Value

Int32[]
An array of random samples from the distribution.

Usage Note

In Visual Basic and C#, you can call this method as an instance method on any object of type IRandomSource. When you use instance method syntax to call this method, omit the first parameter. For more information, see Extension Methods (Visual Basic) or Extension Methods (C# Programming Guide).

Next<TGenerator>(IRandomSource<TGenerator>, ContinuousDistribution, Int32)

Generates an array of random samples from the specified continuous distribution.
C#
public static double[] Next<TGenerator>(
	this IRandomSource<TGenerator> random,
	ContinuousDistribution distribution,
	int count
)
where TGenerator : struct, new(), IRandomGenerator

Parameters

random  IRandomSource<TGenerator>
 
distribution  ContinuousDistribution
The probability distribution to sample from.
count  Int32
The number of samples to generate.

Type Parameters

TGenerator

Return Value

Double[]
An array of random samples from the distribution.

Usage Note

In Visual Basic and C#, you can call this method as an instance method on any object of type IRandomSource<TGenerator>. When you use instance method syntax to call this method, omit the first parameter. For more information, see Extension Methods (Visual Basic) or Extension Methods (C# Programming Guide).

Next<TGenerator>(IRandomSource<TGenerator>, DiscreteDistribution, Int32)

Generates an array of random samples from the specified discrete distribution.
C#
public static int[] Next<TGenerator>(
	this IRandomSource<TGenerator> random,
	DiscreteDistribution distribution,
	int count
)
where TGenerator : struct, new(), IRandomGenerator

Parameters

random  IRandomSource<TGenerator>
 
distribution  DiscreteDistribution
The probability distribution to sample from.
count  Int32
The number of samples to generate.

Type Parameters

TGenerator

Return Value

Int32[]
An array of random samples from the distribution.

Usage Note

In Visual Basic and C#, you can call this method as an instance method on any object of type IRandomSource<TGenerator>. When you use instance method syntax to call this method, omit the first parameter. For more information, see Extension Methods (Visual Basic) or Extension Methods (C# Programming Guide).

Next(Random, ContinuousDistribution, Int32)

Generates an array of random samples from the specified continuous distribution.
C#
public static double[] Next(
	this Random random,
	ContinuousDistribution distribution,
	int count
)

Parameters

random  Random
 
distribution  ContinuousDistribution
The probability distribution to sample from.
count  Int32
The number of samples to generate.

Return Value

Double[]
An array of random samples from the distribution.

Usage Note

In Visual Basic and C#, you can call this method as an instance method on any object of type Random. When you use instance method syntax to call this method, omit the first parameter. For more information, see Extension Methods (Visual Basic) or Extension Methods (C# Programming Guide).

Next(Random, DiscreteDistribution, Int32)

Generates an array of random samples from the specified discrete distribution.
C#
public static int[] Next(
	this Random random,
	DiscreteDistribution distribution,
	int count
)

Parameters

random  Random
 
distribution  DiscreteDistribution
The probability distribution to sample from.
count  Int32
The number of samples to generate.

Return Value

Int32[]
An array of random samples from the distribution.

Usage Note

In Visual Basic and C#, you can call this method as an instance method on any object of type Random. When you use instance method syntax to call this method, omit the first parameter. For more information, see Extension Methods (Visual Basic) or Extension Methods (C# Programming Guide).

See Also