Class RandomGenerator
java.lang.Object
org.episteme.core.mathematics.random.RandomGenerator
High-quality random number generator utilities.
Provides various distributions and seed management.
- Since:
- 1.0
- Author:
- Silvere Martin-Michiellot, Gemini AI (Google DeepMind)
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescription<T> Tchoice(T[] array) Returns random element from array.booleanReturns random boolean.nextExponential(Real lambda) Returns random Real from exponential distribution with rate lambda.Returns random Real from standard normal distribution N(0,1).nextGaussian(Real mean, Real stdDev) Returns random Real from normal distribution N(mean, stdDev).nextInteger(int min, int max) Returns random Integer in [min, max].nextNatural(int bound) Returns random Natural in [0, bound).nextReal()Returns random Real in [0, 1).Returns random Real in [min, max).voidsetSeed(long seed) Sets the seed for reproducibility.<T> voidshuffle(T[] array) Shuffles an array in-place (Fisher-Yates algorithm).
-
Constructor Details
-
RandomGenerator
public RandomGenerator() -
RandomGenerator
public RandomGenerator(long seed)
-
-
Method Details
-
nextReal
Returns random Real in [0, 1). -
nextReal
-
nextInteger
Returns random Integer in [min, max]. -
nextNatural
Returns random Natural in [0, bound). -
nextBoolean
public boolean nextBoolean()Returns random boolean. -
nextGaussian
Returns random Real from standard normal distribution N(0,1). -
nextGaussian
-
nextExponential
-
shuffle
public <T> void shuffle(T[] array) Shuffles an array in-place (Fisher-Yates algorithm). -
choice
public <T> T choice(T[] array) Returns random element from array. -
setSeed
public void setSeed(long seed) Sets the seed for reproducibility.
-