Continuous Distribution.Sample Into Method
Definition
Assembly: Numerics.NET (in Numerics.NET.dll) Version: 10.3.0
Overload List
| Sample | Fills a span with random numbers from the distribution using the default thread-safe random number generator. |
| Sample | Fills the provided list with random samples drawn from this distribution. |
| Sample | Fills a span with random numbers from the distribution. |
| Sample | Fills the provided list with random samples drawn from this distribution. |
| Sample | Fills a list with random numbers from the distribution. |
| Sample | Fills the given span with random samples drawn from this distribution. |
| Sample | Fills a range within a list with random samples drawn from this distribution. |
| Sample | Fills a range within a list with random samples drawn from this distribution. |
| Sample | Fills a span with random numbers from the distribution. |
| Sample | Fills a range within a list with random samples drawn from this distribution. |
SampleInto(Span<Double>)
SampleInto(IRandomSource, IList<Double>)
public void SampleInto(
IRandomSource random,
IList<double> samples
)Parameters
- random IRandomSource
- The Random used to produce uniform variates that are transformed to distribution samples.
- samples IList<Double>
- The destination list to receive generated samples. If samples is an array, this method routes to the span-based overload to avoid extra copying.
Exceptions
| Argument | Thrown if samples is null. |
SampleInto(IRandomSource, Span<Double>)
public void SampleInto(
IRandomSource random,
Span<double> samples
)Parameters
- random IRandomSource
- An IRandomSource to use as the uniform random number generator.
- samples Span<Double>
- A Span<T>.
SampleInto<TGenerator>(IRandomSource<TGenerator>, Span<Double>)
public void SampleInto<TGenerator>(
IRandomSource<TGenerator> random,
Span<double> samples
)
where TGenerator : struct, new(), IRandomGenerator
Parameters
- random IRandomSource<TGenerator>
- An IRandomSource<TGenerator> to use as the uniform random number generator.
- samples Span<Double>
- A Span<T>.
Type Parameters
- TGenerator
- The underlying generator type of the random source, used to enable optimizations like inlining.
SampleInto(Random, IList<Double>)
public void SampleInto(
Random random,
IList<double> samples
)Parameters
Exceptions
| Argument | Thrown if samples is null. |
SampleInto(Random, Double[])
public void SampleInto(
Random random,
double[] samples
)Parameters
Remarks
This method fills samples, with random samples from the distribution.
Exceptions
| Argument | samples is null. -or- random is null. |
SampleInto(Random, Span<Double>)
public virtual void SampleInto(
Random random,
Span<double> samples
)Parameters
Remarks
The default implementation generates values by repeatedly calling Sample(Random). Derived classes may override this method to provide a more efficient bulk-sampling implementation.
Exceptions
| Argument | Thrown when random is null. |
SampleInto<TGenerator>(TGenerator, IList<Double>, Int32, Int32)
public virtual void SampleInto<TGenerator>(
ref TGenerator generator,
IList<double> samples,
int startIndex,
int length
)
where TGenerator : struct, new(), IRandomGenerator
Parameters
- generator TGenerator
- The random number generator used to generate uniform variates.
- samples IList<Double>
- The destination list to receive generated values.
- startIndex Int32
- The zero-based index at which to begin writing.
- length Int32
- The number of samples to write.
Type Parameters
- TGenerator
Remarks
If samples is an array, this method forwards to the span-based implementation for better performance.
Exceptions
| Argument | samples is null. |
| Argument | Thrown when startIndex or length is negative. |
| Argument | Thrown when the specified range (startIndex + length) exceeds the bounds of samples. |
SampleInto(IRandomSource, IList<Double>, Int32, Int32)
public virtual void SampleInto(
IRandomSource random,
IList<double> samples,
int startIndex,
int length
)Parameters
Remarks
If samples is an array, this method forwards to the span-based implementation for better performance.
Exceptions
| Argument | Thrown if samples or random is null. |
| Argument | Thrown when startIndex or length is negative. |
| Argument | Thrown when the specified range (startIndex + length) exceeds the bounds of samples. |
SampleInto(Random, IList<Double>, Int32, Int32)
public void SampleInto(
Random random,
IList<double> samples,
int startIndex,
int length
)Parameters
Remarks
If samples is an array, this method forwards to the span-based implementation for better performance.
Exceptions
| Argument | Thrown if samples or random is null. |
| Argument | Thrown when startIndex or length is negative. |
| Argument | Thrown when the specified range (startIndex + length) exceeds the bounds of samples. |