All Packages  This Package  Class Hierarchy  Class Search  Index

Class aima.stat.rv.BiasedNDie

java.lang.Object
   |
   +----aima.stat.rv.FiniteSampler
           |
           +----aima.stat.rv.BiasedNDie

A biased n-sided die. This is the most trivial subclass of the class FiniteSampler. It essentially adds no new functionality; it wraps the FiniteSampler with the intRV interface.

See Also: FiniteSampler


public class  BiasedNDie
     extends aima.stat.rv.FiniteSampler
     implements aima.stat.rv.intRV
{
          // Constructors 3
     public BiasedNDie();
     public BiasedNDie(int);
     public BiasedNDie(int, double[]);

          // Methods 2
     public int sample();
     public Object sampleObject();
}



Constructors


BiasedNDie

   public BiasedNDie() 

Constructor initializing only the random source.



BiasedNDie

   public BiasedNDie(int n) 

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



BiasedNDie

   public BiasedNDie(int n, 
                     double[] p) 

Constructor initializing the random source, the number of sides, and the distribution.




Methods


sample

   public int sample() 

Sample/roll the die.

Returns:
i with probability prob[i] (0 <= i < n.)
Implements:
sample in interface intRV


sampleObject

   public Object sampleObject() 

Sample/roll the die.

Returns:
Integer(i) with probability prob[i] (0 <= i < n.)


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