probabilistic
Class UniformChoice

java.lang.Object
  extended by probabilistic.UniformChoice

public class UniformChoice
extends Object

The class UniformChoice contains the static method make. This method, given a positive integer n, returns an integer i, where 0 ≤ i < n, with equal probability.

Author:
Xin Zhang, Franck van Breugel
See Also:
Choice

Method Summary
static int make(int n)
          Returns an integer in the interval [0, n-1], each with probability 1/n.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

make

public static int make(int n)
Returns an integer in the interval [0, n-1], each with probability 1/n.

Parameters:
n - number of alternatives.
Precondition:
n ≥ 1
Returns:
an integer in the interval [0, n-1], each with probability 1/n.