Matrix.CreateRandom Method

Definition

Namespace: Numerics.NET
Assembly: Numerics.NET (in Numerics.NET.dll) Version: 9.0.4

Overload List

CreateRandom(Int32, Int32, ArrayMutability) Constructs a new matrix with uniform random numbers between 0 and 1.
CreateRandom(Int32, Int32, Random, ArrayMutability) Constructs a new matrix with uniform random numbers between 0 and 1.

CreateRandom(Int32, Int32, ArrayMutability)

Constructs a new matrix with uniform random numbers between 0 and 1.
C#
public static DenseMatrix<double> CreateRandom(
	int rowCount,
	int columnCount,
	ArrayMutability mutability = ArrayMutability.MutableValues
)

Parameters

rowCount  Int32
The number of rows in the new matrix.
columnCount  Int32
The number of columns in the new matrix.
mutability  ArrayMutability  (Optional)
Specifies how the matrix's values may be changed. The default is mutable values.

Return Value

DenseMatrix<Double>
A DenseMatrix<T>.

Exceptions

ArgumentOutOfRangeException

rowCount is less than zero.

-or-

columnCount is less than zero.

CreateRandom(Int32, Int32, Random, ArrayMutability)

Constructs a new matrix with uniform random numbers between 0 and 1.
C#
public static DenseMatrix<double> CreateRandom(
	int rowCount,
	int columnCount,
	Random random,
	ArrayMutability mutability = ArrayMutability.MutableValues
)

Parameters

rowCount  Int32
The number of rows in the new matrix.
columnCount  Int32
The number of columns in the new matrix.
random  Random
A random number generator used to generate samples from the distribution.
mutability  ArrayMutability  (Optional)
Specifies how the matrix's values may be changed. The default is mutable values.

Return Value

DenseMatrix<Double>
A DenseMatrix<T>.

Exceptions

ArgumentOutOfRangeException

rowCount is less than zero.

-or-

columnCount is less than zero.

ArgumentNullException

random is null.

See Also