Click or drag to resize
Accord.NET (logo)

GeneralDiscreteDistributionRandom Method (Double, Int32, Int32, Random, Boolean)

Returns a random sample within the given symbol probabilities.

Namespace:  Accord.Statistics.Distributions.Univariate
Assembly:  Accord.Statistics (in Accord.Statistics.dll) Version: 3.8.0
Syntax
public static int[] Random(
	double[] probabilities,
	int samples,
	int[] result,
	Random source,
	bool log = false
)
Request Example View Source

Parameters

probabilities
Type: SystemDouble
The probabilities for the discrete symbols.
samples
Type: SystemInt32
The number of samples to generate.
result
Type: SystemInt32
The location where to store the samples.
source
Type: SystemRandom
The random number generator to use as a source of randomness. Default is to use Random.
log (Optional)
Type: SystemBoolean
Pass true if the probabilities vector contains log-probabilities instead of standard probabilities.

Return Value

Type: Int32
A random sample within the given probabilities.
See Also