public class RandomFactory
extends java.lang.Object
Random
generator objects.
It does not provide individual random numbers, but will create a random
generator; either using a fixed seed or random seeded (default).
The seed can be globally predefined using -Delki.seed=123
.
These classes are not optimized for non-predictability, but for speed, as
scientific experiments are not likely to be adversarial.Modifier and Type | Field and Description |
---|---|
static RandomFactory |
DEFAULT
Global default factory
|
protected long |
seed
Seed.
|
Constructor and Description |
---|
RandomFactory(long seed)
Constructor.
|
Modifier and Type | Method and Description |
---|---|
static RandomFactory |
get(java.lang.Long seed)
Factory method: Get a random factory for the given seed.
|
private static long |
getGlobalSeed()
Initialize the default random.
|
java.util.Random |
getRandom()
Get a random generator.
|
java.util.Random |
getSingleThreadedRandom()
Get a non-threadsafe random generator.
|
java.lang.String |
toString() |
public static RandomFactory DEFAULT
protected long seed
public RandomFactory(long seed)
seed
- Random seedprivate static long getGlobalSeed()
public static RandomFactory get(java.lang.Long seed)
seed
- Seedpublic java.util.Random getRandom()
public java.util.Random getSingleThreadedRandom()
public java.lang.String toString()
toString
in class java.lang.Object
Copyright © 2019 ELKI Development Team. License information.