Class Roulette

java.lang.Object
  |
  +--Roulette

public class Roulette
extends java.lang.Object


Constructor Summary
Roulette(double[] fits)
          Creates a roulette wheel with arbitrary initial conditions.
Roulette(double[] fits, long seed)
          Creates a roulette wheel with seed for random-number generator, to support reproducible results.
 
Method Summary
 int roll()
          "Rolls the wheel" to get an integer in [0,N), where N is the number of fitness values specified in the constructor.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Roulette

public Roulette(double[] fits)
Creates a roulette wheel with arbitrary initial conditions.

Parameters:
fits - population fitnesses

Roulette

public Roulette(double[] fits,
                long seed)
Creates a roulette wheel with seed for random-number generator, to support reproducible results.

Parameters:
fits - population fitnesses
seed - seed for random-number generator
Method Detail

roll

public int roll()
"Rolls the wheel" to get an integer in [0,N), where N is the number of fitness values specified in the constructor.

Returns:
an integer in [0,N)