edu.usc.bg.base.generator
Class UniformIntegerGenerator

java.lang.Object
  extended by edu.usc.bg.base.generator.Generator
      extended by edu.usc.bg.base.generator.IntegerGenerator
          extended by edu.usc.bg.base.generator.UniformIntegerGenerator

public class UniformIntegerGenerator
extends IntegerGenerator

Generates integers randomly uniform from an interval.


Constructor Summary
UniformIntegerGenerator(int lb, int ub)
          Creates a generator that will return integers uniformly randomly from the interval [lb,ub] inclusive (that is, lb and ub are possible values).
 
Method Summary
 double mean()
          Return the expected value (mean) of the values this generator will return.
 int nextInt()
          Return the next value as an int.
 
Methods inherited from class edu.usc.bg.base.generator.IntegerGenerator
lastInt, lastString, nextString
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

UniformIntegerGenerator

public UniformIntegerGenerator(int lb,
                               int ub)
Creates a generator that will return integers uniformly randomly from the interval [lb,ub] inclusive (that is, lb and ub are possible values).

Parameters:
lb - the lower bound (inclusive) of generated values.
ub - the upper bound (inclusive) of generated values.
Method Detail

nextInt

public int nextInt()
Description copied from class: IntegerGenerator
Return the next value as an int. When overriding this method, be sure to call setLastString() properly, or the lastString() call won't work.

Specified by:
nextInt in class IntegerGenerator

mean

public double mean()
Description copied from class: IntegerGenerator
Return the expected value (mean) of the values this generator will return.

Specified by:
mean in class IntegerGenerator