org.encog.mathutil.randomize

## Class BasicRandomizer

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

- All Implemented Interfaces:
    Randomizer
  Direct Known Subclasses:
    ConsistentRandomizer, ConstRandomizer, Distort, FanInRandomizer, GaussianRandomizer, NguyenWidrowRandomizer, RangeRandomizer

      public abstract class BasicRandomizer
      extends Object
      implements Randomizer

  Provides basic functionality that most randomizers will need.
  Author:
    jheaton

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `BasicRandomizer()` Construct a random number generator with a random(current time) seed.

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `GenerateRandom` | `getRandom()`
    `double` | `nextDouble()`
    `double` | `nextDouble(double min, double max)` Generate a random number in the specified range.
    `void` | `randomize(BasicNetwork network, int fromLayer)` Randomize one level of a neural network.
    `void` | `randomize(double[] d)` Randomize the array based on an array, modify the array.
    `void` | `randomize(double[][] d)` Randomize the 2d array based on an array, modify the array.
    `void` | `randomize(double[] d, int begin, int size)` Randomize the array based on an array, modify the array.
    `void` | `randomize(Matrix m)` Randomize the matrix based on an array, modify the array.
    `void` | `randomize(MLMethod method)` Randomize the synapses and biases in the basic network based on an array, modify the array.
    `void` | `setRandom(GenerateRandom theRandom)` Explicitly set the Random source

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

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

    - ### Methods inherited from interface org.encog.mathutil.randomize.Randomizer

      `randomize`

- - ### Constructor Detail

    - #### BasicRandomizer

          public BasicRandomizer()

      Construct a random number generator with a random(current time) seed. If you want to set your own seed, just call "getRandom().setSeed".

  - ### Method Detail

    - #### getRandom

          public final GenerateRandom getRandom()

      Specified by:
        `getRandom` in interface `Randomizer`
      Returns:
        The random number generator in use. Use this to set the seed, if desired.

    - #### nextDouble

          public final double nextDouble()

      Returns:
        The next double.

    - #### nextDouble

          public final double nextDouble(double min,
                          double max)

      Generate a random number in the specified range.
      Parameters:
        `min` - The minimum value.
        `max` - The maximum value.
      Returns:
        A random number.

    - #### randomize

          public void randomize(BasicNetwork network,
                       int fromLayer)

      Randomize one level of a neural network.
      Parameters:
        `network` - The network to randomize
        `fromLayer` - The from level to randomize.

    - #### randomize

          public void randomize(double[] d)

      Randomize the array based on an array, modify the array. Previous values may be used, or they may be discarded, depending on the randomizer.
      Specified by:
        `randomize` in interface `Randomizer`
      Parameters:
        `d` - An array to randomize.

    - #### randomize

          public void randomize(double[] d,
                       int begin,
                       int size)

      Randomize the array based on an array, modify the array. Previous values may be used, or they may be discarded, depending on the randomizer.
      Specified by:
        `randomize` in interface `Randomizer`
      Parameters:
        `d` - An array to randomize.
        `begin` - The beginning element of the array.
        `size` - The size of the array to copy.

    - #### randomize

          public void randomize(double[][] d)

      Randomize the 2d array based on an array, modify the array. Previous values may be used, or they may be discarded, depending on the randomizer.
      Specified by:
        `randomize` in interface `Randomizer`
      Parameters:
        `d` - An array to randomize.

    - #### randomize

          public void randomize(Matrix m)

      Randomize the matrix based on an array, modify the array. Previous values may be used, or they may be discarded, depending on the randomizer.
      Specified by:
        `randomize` in interface `Randomizer`
      Parameters:
        `m` - A matrix to randomize.

    - #### randomize

          public void randomize(MLMethod method)

      Randomize the synapses and biases in the basic network based on an array, modify the array. Previous values may be used, or they may be discarded, depending on the randomizer.
      Specified by:
        `randomize` in interface `Randomizer`
      Parameters:
        `method` - A network to randomize.

    - #### setRandom

          public final void setRandom(GenerateRandom theRandom)

      Description copied from interface: `Randomizer`
      Explicitly set the Random source
      Specified by:
        `setRandom` in interface `Randomizer`
      Parameters:
        `theRandom` - the random to set

Copyright © 2014. All Rights Reserved.