net.sourceforge.cilib.math.random.generator
Class KnuthSubtractive

java.lang.Object
  extended by java.util.Random
      extended by net.sourceforge.cilib.math.random.generator.Random
          extended by net.sourceforge.cilib.math.random.generator.KnuthSubtractive
All Implemented Interfaces:
Serializable, Cloneable

public class KnuthSubtractive
extends Random

An implementation of Knuth's subtractive random number generator. This generator is relatively fast but is not considered simulation quality.

This code is based on the implementation in GSL (GNU Scientific Library) which is also covered by the GNU General Public License. The original C source code is Copyright (C) 1996, 1997, 1998, 1999, 2000 James Theiler and Brian Gough.

Author:
Edwin Peer
See Also:
Serialized Form

Constructor Summary
KnuthSubtractive()
          Create an instance of KnuthSubtractive.
KnuthSubtractive(long seed)
          Create an instance, with the given seed value.
 
Method Summary
 KnuthSubtractive getClone()
          Create a cloned copy of the current object and return it.
protected  int next(int bits)
          
 void setSeed(long seed)
          
 
Methods inherited from class java.util.Random
nextBoolean, nextBytes, nextDouble, nextFloat, nextGaussian, nextInt, nextInt, nextLong
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

KnuthSubtractive

public KnuthSubtractive()
Create an instance of KnuthSubtractive.


KnuthSubtractive

public KnuthSubtractive(long seed)
Create an instance, with the given seed value.

Parameters:
seed - The seed value.
Method Detail

getClone

public KnuthSubtractive getClone()
Create a cloned copy of the current object and return it. In general the created copy will be a deep copy of the provided instance. As a result this operation an be quite expensive if used incorrectly.

Specified by:
getClone in interface Cloneable
Specified by:
getClone in class Random
Returns:
An exact clone of the current object instance.
See Also:
Object.clone()

setSeed

public void setSeed(long seed)

Overrides:
setSeed in class Random

next

protected int next(int bits)

Overrides:
next in class Random


Copyright © 2009 CIRG. All Rights Reserved.