RandomExtensions.Fill Method

Definition

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

Overload List

Fill(Random, Vector<Double>, ContinuousDistribution) Fills a vector with random samples from the specified distribution.
Fill(Random, Vector<Double>, DiscreteDistribution) Fills a vector with random samples from the specified distribution.
Fill(Random, Double[], ContinuousDistribution) Fills a Double array with random samples from the specified distribution.
Fill(Random, Int32[], DiscreteDistribution) Fills an Int32 array with random samples from the specified distribution.
Fill(Random, Double[], Int32, Int32) Fills a Double array with random samples from the specified distribution.
Fill(Random, Int32[], Int32, Int32) Fills an Int32 array with random samples from the specified distribution.
Fill(Random, Double[], Int32, Int32, ContinuousDistribution) Fills a Double array with random samples from the specified distribution.
Fill(Random, Int32[], Int32, Int32, DiscreteDistribution) Fills an Int32 array with random samples from the specified distribution.

Fill(Random, Vector<Double>, ContinuousDistribution)

Fills a vector with random samples from the specified distribution.
C#
public static void Fill(
	this Random random,
	Vector<double> samples,
	ContinuousDistribution distribution
)

Parameters

random  Random
A random number generator used to generate samples from the distribution.
samples  Vector<Double>
A vector.
distribution  ContinuousDistribution
A ContinuousDistribution object.

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

Exceptions

ArgumentNullException

samples is null.

Fill(Random, Vector<Double>, DiscreteDistribution)

Fills a vector with random samples from the specified distribution.
C#
public static void Fill(
	this Random random,
	Vector<double> samples,
	DiscreteDistribution distribution
)

Parameters

random  Random
A random number generator used to generate samples from the distribution.
samples  Vector<Double>
A vector.
distribution  DiscreteDistribution
A DiscreteDistribution object.

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

Exceptions

ArgumentNullException

samples is null.

-or-

distribution is null.

Fill(Random, Double[], ContinuousDistribution)

Fills a Double array with random samples from the specified distribution.
C#
public static void Fill(
	this Random random,
	double[] samples,
	ContinuousDistribution distribution
)

Parameters

random  Random
A random number generator used to generate samples from the distribution.
samples  Double[]
A Double array.
distribution  ContinuousDistribution
A ContinuousDistribution object.

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

Exceptions

ArgumentNullException

samples is null.

-or-

distribution is null.

Fill(Random, Int32[], DiscreteDistribution)

Fills an Int32 array with random samples from the specified distribution.
C#
public static void Fill(
	this Random random,
	int[] samples,
	DiscreteDistribution distribution
)

Parameters

random  Random
A random number generator used to generate samples from the distribution.
samples  Int32[]
A Int32 array.
distribution  DiscreteDistribution
A DiscreteDistribution object.

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

Exceptions

ArgumentNullException

samples is null.

-or-

distribution is null.

Fill(Random, Double[], Int32, Int32)

Fills a Double array with random samples from the specified distribution.
C#
public static void Fill(
	this Random random,
	double[] samples,
	int startIndex,
	int length
)

Parameters

random  Random
A random number generator used to generate samples from the distribution.
samples  Double[]
A Double array.
startIndex  Int32
The zero-based index at which to begin filling the samples array.
length  Int32
The number of samples to provide.

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

Exceptions

ArgumentNullException

samples is null.

ArgumentOutOfRangeException

startIndex is less than zero.

-or-

length is less than zero.

ArgumentException

length is greater than the number of elements from startIndex to the end of samples.

Fill(Random, Int32[], Int32, Int32)

Fills an Int32 array with random samples from the specified distribution.
C#
public static void Fill(
	this Random random,
	int[] samples,
	int startIndex,
	int length
)

Parameters

random  Random
A random number generator used to generate samples from the distribution.
samples  Int32[]
A Int32 array.
startIndex  Int32
The zero-based index at which to begin filling the samples array.
length  Int32
The number of samples to provide.

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

Exceptions

ArgumentNullException

samples is null.

ArgumentOutOfRangeException

startIndex is less than zero.

-or-

length is less than zero.

ArgumentException

length is greater than the number of elements from startIndex to the end of samples.

Fill(Random, Double[], Int32, Int32, ContinuousDistribution)

Fills a Double array with random samples from the specified distribution.
C#
public static void Fill(
	this Random random,
	double[] samples,
	int startIndex,
	int length,
	ContinuousDistribution distribution
)

Parameters

random  Random
A random number generator used to generate samples from the distribution.
samples  Double[]
A Double array.
startIndex  Int32
The zero-based index at which to begin filling the samples array.
length  Int32
The number of samples to provide.
distribution  ContinuousDistribution
A ContinuousDistribution object.

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

Remarks

If distribution is null, then a uniform distribution on the interval [0,1) is assumed.

Exceptions

ArgumentNullException

samples is null.

ArgumentOutOfRangeException

startIndex is less than zero.

-or-

length is less than zero.

ArgumentException

length is greater than the number of elements from startIndex to the end of samples.

Fill(Random, Int32[], Int32, Int32, DiscreteDistribution)

Fills an Int32 array with random samples from the specified distribution.
C#
public static void Fill(
	this Random random,
	int[] samples,
	int startIndex,
	int length,
	DiscreteDistribution distribution
)

Parameters

random  Random
A random number generator used to generate samples from the distribution.
samples  Int32[]
A Int32 array.
startIndex  Int32
The zero-based index at which to begin filling the samples array.
length  Int32
The number of samples to provide.
distribution  DiscreteDistribution
A DiscreteDistribution object.

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

Exceptions

ArgumentNullException

samples is null.

ArgumentOutOfRangeException

startIndex is less than zero.

-or-

length is less than zero.

ArgumentException

length is greater than the number of elements from startIndex to the end of samples.

See Also