org.encog.mathutil.randomize

## Class RandomChoice

- java.lang.Object
- - org.encog.mathutil.randomize.RandomChoice

- All Implemented Interfaces:
    Serializable

      public class RandomChoice
      extends Object
      implements Serializable

  Generate random choices unevenly. This class is used to select random choices from a list, with a probability weight places on each item in the list. This is often called a Roulette Wheel in Machine Learning texts. How it differs from a Roulette Wheel that you might find in Las Vegas or Monte Carlo is that the areas that can be selected are not of uniform size. However, you can be sure that one will be picked. http://en.wikipedia.org/wiki/Fitness_proportionate_selection
  See Also:
    Serialized Form

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `RandomChoice(double[] theProbabilities)` Construct a list of probabilities.

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `int` | `generate(Random theGenerator)` Generate a random choice, based on the probabilities provided to the constructor.
    `int` | `generate(Random theGenerator, int skip)` Generate a random choice, but skip one of the choices.

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### RandomChoice

          public RandomChoice(double[] theProbabilities)

      Construct a list of probabilities.
      Parameters:
        `theProbabilities` - The probability of each item in the list.

  - ### Method Detail

    - #### generate

          public int generate(Random theGenerator)

      Generate a random choice, based on the probabilities provided to the constructor.
      Returns:
        The random choice.

    - #### generate

          public int generate(Random theGenerator,
                     int skip)

      Generate a random choice, but skip one of the choices.
      Parameters:
        `skip` - The choice to skip.
      Returns:
        The random choice.

Copyright © 2014. All Rights Reserved.