org.encog.mathutil.randomize
Class BasicRandomizer

java.lang.Object
  extended by org.encog.mathutil.randomize.BasicRandomizer
All Implemented Interfaces:
Randomizer
Direct Known Subclasses:
ConsistentRandomizer, ConstRandomizer, Distort, FanInRandomizer, GaussianRandomizer, RangeRandomizer

public abstract class BasicRandomizer
extends Object
implements Randomizer

Provides basic functionality that most randomizers will need.

Author:
jheaton

Constructor Summary
BasicRandomizer()
          Construct a random number generator with a random(current time) seed.
 
Method Summary
 Random getRandom()
           
 double nextDouble()
           
 double nextDouble(double min, double max)
          Generate a random number in the specified range.
 void randomize(BasicNetwork network)
          Randomize the synapses and biases in the basic network based on an array, modify the array.
 void randomize(BasicNetwork network, Synapse synapse)
          Randomize a synapse, only randomize those connections that are actually connected.
 void randomize(double[] d)
          Randomize the array based on an array, modify the array.
 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)
          Randomize the 2d array based on an array, modify the array.
 void randomize(Matrix m)
          Randomize the matrix based on an array, modify the array.
 void setRandom(Random random)
           
 
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

randomize

public void randomize(BasicNetwork network)
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:
network - A network to randomize.

randomize

public void randomize(BasicNetwork network,
                      Synapse synapse)
Randomize a synapse, only randomize those connections that are actually connected.

Parameters:
network - The network the synapse belongs to.
synapse - The synapse 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)
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)
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(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.

getRandom

public Random getRandom()
Returns:
The random number generator in use. Use this to set the seed, if desired.

nextDouble

public double nextDouble()
Returns:
The next double.

setRandom

public void setRandom(Random random)
Parameters:
random - the random to set

nextDouble

public 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.


Copyright © 2011. All Rights Reserved.