com.jsyn.util
Class PseudoRandom

java.lang.Object
  extended by com.jsyn.util.PseudoRandom

public class PseudoRandom
extends java.lang.Object

Pseudo-random numbers using predictable and fast linear-congruential method.


Constructor Summary
PseudoRandom()
          Create an instance of SynthRandom.
PseudoRandom(long seed)
          Create an instance of SynthRandom.
 
Method Summary
 double convertIntToDouble(int n)
          Scale an integer into the range -1.0 to +1.0;
 double nextRandomDouble()
          Returns the next random double from -1.0 to 1.0
 int nextRandomInteger()
          Calculate random 32 bit number using linear-congruential method.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PseudoRandom

public PseudoRandom()
Create an instance of SynthRandom.


PseudoRandom

public PseudoRandom(long seed)
Create an instance of SynthRandom.

Method Detail

convertIntToDouble

public double convertIntToDouble(int n)
Scale an integer into the range -1.0 to +1.0;

Parameters:
n -
Returns:
A double in the range -1.0 to +1.0;

nextRandomDouble

public double nextRandomDouble()
Returns the next random double from -1.0 to 1.0

Returns:
value from -1.0 to 1.0

nextRandomInteger

public int nextRandomInteger()
Calculate random 32 bit number using linear-congruential method.