Discrete Distribution<T>.Sample Method
Definition
Assembly: Numerics.NET (in Numerics.NET.dll) Version: 10.3.0
Overload List
| Sample() | Returns a random sample from the distribution. |
| Sample( | Returns a vector of random samples from the distribution. |
| Sample( | Returns the level index of a random sample from the distribution. |
| Sample( | Returns a random sample from the distribution. |
| Sample( | Returns a vector of random samples from the distribution. |
| Sample( | Fills a span with random samples from this DiscreteDistribution<T>. |
| Sample( | Fills a span with random samples from this DiscreteDistribution<T>. |
| Sample( | Fills a span with random samples from this DiscreteDistribution<T>. |
| Sample( | Fills a span with random samples from this DiscreteDistribution<T>. |
| Sample<TGenerator>(IRandomSource<TGenerator>) | |
| Sample<TGenerator>(Int32, IRandomSource<TGenerator>) | Returns a vector of random samples from the distribution. |
| Sample<TGenerator>(IRandomSource<TGenerator>, Span<T>) | Fills a span with random samples from this DiscreteDistribution<T>. |
| Sample<TGenerator>(TGenerator, Span<T>) | Fills a span 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(IRandomSource)
public T Sample(
IRandomSource random
)Parameters
- random IRandomSource
- A Random object that specifies the uniform random number generator that is to be used to generate the samples.
Return Value
TThe index of the sample in the set of items.
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<TGenerator>(IRandomSource<TGenerator>)
public T Sample<TGenerator>(
IRandomSource<TGenerator> random
)
where TGenerator : struct, new(), IRandomGenerator
Parameters
- random IRandomSource<TGenerator>
Type Parameters
- TGenerator
Return Value
TSample(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<TGenerator>(Int32, IRandomSource<TGenerator>)
public CategoricalVector<T> Sample<TGenerator>(
int count,
IRandomSource<TGenerator> random
)
where TGenerator : struct, new(), IRandomGenerator
Parameters
- count Int32
- The number of samples to return.
- random IRandomSource<TGenerator>
- A Random object that specifies the uniform random number generator that is to be used to generate the samples.
Type Parameters
- TGenerator
- The underlying generator type of the random source, used to enable optimizations like inlining.
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(IRandomSource, Span<T>)
public void Sample(
IRandomSource random,
Span<T> samples
)Parameters
- random IRandomSource
- A Random object that specifies the uniform random number generator that is to be used to generate the samples.
- samples Span<T>
- A span.
Remarks
This method fills a block of length elements of samples, starting at index startIndex with random samples from the distribution.
Exceptions
| Argument | random is null. |
Sample<TGenerator>(IRandomSource<TGenerator>, Span<T>)
public void Sample<TGenerator>(
IRandomSource<TGenerator> random,
Span<T> samples
)
where TGenerator : struct, new(), IRandomGenerator
Parameters
- random IRandomSource<TGenerator>
- A Random object that specifies the uniform random number generator that is to be used to generate the samples.
- samples Span<T>
- A span.
Type Parameters
- TGenerator
- The underlying generator type of the random source, used to enable optimizations like inlining.
Remarks
This method fills a block of length elements of samples, starting at index startIndex with random samples from the distribution.
Exceptions
| Argument | random is null. |
Sample(Random, T[])
public void Sample(
Random random,
T[] samples
)Parameters
Remarks
This method fills a block of length elements of samples, starting at index startIndex with random samples from the distribution.
Exceptions
| Argument | random is null. |
Sample(Random, Span<T>)
public void Sample(
Random random,
Span<T> samples
)Parameters
Remarks
This method fills a block of length elements of samples, starting at index startIndex with random samples from the distribution.
Exceptions
| Argument | random is null. |
Sample<TGenerator>(TGenerator, Span<T>)
public void Sample<TGenerator>(
ref TGenerator generator,
Span<T> samples
)
where TGenerator : struct, new(), IRandomGenerator
Parameters
Type Parameters
- TGenerator
- The underlying generator type of the random source, used to enable optimizations like inlining.
Remarks
This method fills a block of length elements of samples, starting at index startIndex with random samples from the distribution.
Exceptions
| Argument | random 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 | random is null. |