Click or drag to resize
StdRandomDiscrete Method (Double)
Returns a random integer from the specified discrete distribution.

Namespace: Algs4Net
Assembly: Algs4Net (in Algs4Net.dll) Version: 1.0.0.0 (1.0.0.0)
Syntax
C#
public static int Discrete(
	double[] probabilities
)

Parameters

probabilities
Type: SystemDouble
probabilities the probability of occurrence of each integer

Return Value

Type: Int32
a random integer from a discrete distribution: i with probability probabilities[i]
Exceptions
ExceptionCondition
ArgumentNullException if probabilities is null
ArgumentExceptionif sum of array entries is not (very nearly) equal to 1.0
ArgumentExceptionunless probabilities[i] >= 0.0 for each index i
See Also