Discrete Distribution<T>.Sample Method
Definition
Assembly: Numerics.NET (in Numerics.NET.dll) Version: 9.0.2
Overload List
Sample() | Returns a random sample from the distribution. |
Sample( | Returns a vector of random samples from the distribution. |
Sample( | Returns a random sample from the distribution. |
Sample( | Returns a vector of random samples from the distribution. |
Sample( | Fills an array with random samples. |
Sample( | Fills an array with random samples from this DiscreteDistribution<T>. |
Sample
Remarks
This method uses the default random number generator specified by DefaultRandomNumberGenerator to generate a random sample from the distribution. The return values of successive calls to this method follow the statistical distribution represented by this distribution.
Sample(Int32)
public CategoricalVector<T> Sample(
int count
)
Parameters
- count Int32
- The number of samples to return.
Return Value
CategoricalVector<T>A categorical vector of samples.
Remarks
This method uses the default random number generator specified by DefaultRandomNumberGenerator to generate random samples from the distribution. The return value contains a set of values that follow the statistical distribution represented by this distribution.
Sample(Random)
public T Sample(
Random random
)
Parameters
- random Random
- A Random object that specifies the uniform random number generator that is to be used to generate the samples.
Return Value
TA sample from the distribution.
Remarks
This method uses the random number generator specified by random to generate a random sample from the distribution. The return values of successive calls to this method follow the statistical distribution represented by this distribution.
Sample(Int32, Random)
public CategoricalVector<T> Sample(
int count,
Random random
)
Parameters
- count Int32
- The number of samples to return.
- random Random
- A Random object that specifies the uniform random number generator that is to be used to generate the samples.
Return Value
CategoricalVector<T>A categorical vector of samples.
Remarks
This method uses the random number generator specified by random to generate a random sample from the distribution. The return value contains a set of values that follow the statistical distribution represented by this distribution.
Sample(Random, T[])
public void Sample(
Random random,
T[] samples
)
Parameters
Remarks
This method fills the integer array samples with random samples from the distribution.
Exceptions
Argument | random is null. -or- samples is null. |
Sample(Random, T[], Int32, Int32)
public void Sample(
Random random,
T[] samples,
int startIndex,
int length
)
Parameters
Remarks
This method fills a block of length elements of samples, starting at index startIndex with random samples from the distribution.
Exceptions
Argument | samples is null. -or- random is null. |
Argument | startIndex is less than zero. -or- length is less than zero. |
Argument | length is greater than the number of elements from startIndex to the end of samples. |