All Packages This Package Class Hierarchy Class Search Index
java.lang.Object | +----aima.stat.rv.NDie
An n-sided die. Sampling returns one of {0,1,...,n-1} with (approximately) equal probability.
public class NDie extends java.lang.Object implements aima.stat.rv.intRV { // Constructors 2 public NDie(); public NDie(int); // Methods 4 public int getN(); public int sample(); public Object sampleObject(); public void setN(int); }
public NDie()
Constructor initializing only the random source.
public NDie(int n)
Constructor initializing the random source and the number of sides on the die.
public int sample()
Sample/roll the die.
- Returns:
- i with probability (approximately) 1/n.
- Implements:
- sample in interface intRV
public Object sampleObject()
Sample/roll the die.
- Returns:
- Integer(i) with probability (approximately) 1/n.
public void setN(int n)
public int getN()
All Packages This Package Class Hierarchy Class Search IndexFreshly brewed Java API Documentation automatically generated with polardoc Version 1.0.4