Discrete Distribution.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 Int32 array with random numbers. |
Sample( | Fills an Int32 array with random numbers from this DiscreteDistribution. |
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 Vector<int> Sample(
int count
)
Parameters
- count Int32
- The number of samples to return.
Return Value
Vector<Int32>A signed 32-bit integer.
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 virtual int 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
Int32A signed 32-bit integer.
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 Vector<int> 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
Vector<Int32>A vector of signed 32-bit integers.
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, Int32[])
public void Sample(
Random random,
int[] 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, Int32[], Int32, Int32)
public virtual void Sample(
Random random,
int[] 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. |