All Packages  This Package  Class Hierarchy  Class Search  Index

Class aima.stat.rv.NDie

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);
}



Constructors


NDie

   public NDie() 

Constructor initializing only the random source.



NDie

   public NDie(int n) 

Constructor initializing the random source and the number of sides on the die.




Methods


sample

   public int sample() 

Sample/roll the die.

Returns:
i with probability (approximately) 1/n.
Implements:
sample in interface intRV


sampleObject

   public Object sampleObject() 

Sample/roll the die.

Returns:
Integer(i) with probability (approximately) 1/n.


setN

   public void setN(int n) 


getN

   public int getN() 


All Packages  This Package  Class Hierarchy  Class Search  Index
Freshly brewed Java API Documentation automatically generated with polardoc Version 1.0.4