Package com.softsynth.jmsl.util
Class RandomDriver
java.lang.Object
com.softsynth.jmsl.util.RandomDriver
public class RandomDriver
extends java.lang.Object
RandomDriver, an object of this type generates a random number sequence whose seed can be set and gotten.
This is just like JMSLRandom except it can be instantiated, ie it has non-static methods.
Use this when you want more than one random number sequence
in a piece, where one or more of them may have the seed reset independently of the others.
- Author:
- Phil Burk and Nick Didkovsky
-
Constructor Summary
Constructors Constructor Description RandomDriver() -
Method Summary
Modifier and Type Method Description doublechoose()doublechoose(double high)doublechoose(double low, double high)intchoose(int high)intchoose(int low, int high)doublechoosePlusMinus(double range)return random double between +range and -rangeintchoosePlusMinus(int range)return random integer between +range and -range, inclusivedoublegauss(double sigma, double xmu)Return a Gaussian distributed value.intgetSeed()static voidmain(java.lang.String[] args)intqa()voidrandomize()set random seed from timevoidsetSeed(int newSeed)Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Constructor Details
-
RandomDriver
public RandomDriver()
-
-
Method Details
-
getSeed
public int getSeed() -
setSeed
public void setSeed(int newSeed) -
randomize
public void randomize()set random seed from time -
choose
public double choose()- Returns:
- random float [0..1)
-
choose
public int choose(int high)- Returns:
- random int [0..high)
-
choose
public double choose(double high)- Returns:
- random double [0..high)
-
choose
public int choose(int low, int high)- Returns:
- random int [low..high)
-
choose
public double choose(double low, double high)- Returns:
- random double [low..high)
-
choosePlusMinus
public int choosePlusMinus(int range)return random integer between +range and -range, inclusive -
choosePlusMinus
public double choosePlusMinus(double range)return random double between +range and -range -
gauss
public double gauss(double sigma, double xmu)Return a Gaussian distributed value. sigma controls narrowness of bell, xmu controls the centering of bell. Small sigmas make tight narrow bells. -
qa
public int qa() -
main
public static void main(java.lang.String[] args)
-