Package io.github.krandom
Class KRandom
-
- All Implemented Interfaces:
-
java.io.Serializable
,java.util.random.RandomGenerator
public class KRandom extends Random
Extension of java.util.Random that is able to generate random Java objects.
Mahmoud Ben Hassine ([email protected])
-
-
Constructor Summary
Constructors Constructor Description KRandom()
Create a new KRandom instance with default parameters. KRandom(KRandomParameters kRandomParameters)
Create a new KRandom instance.
-
Method Summary
Modifier and Type Method Description <T> T
nextObject(Class<T> type)
Generate a random instance of the given type. <T> Stream<T>
objects(Class<T> type, int streamSize)
Generate a stream of random instances of the given type. -
Methods inherited from class java.util.Random
doubles, from, ints, longs, nextBoolean, nextBytes, nextDouble, nextFloat, nextGaussian, nextInt, nextLong, setSeed
-
Methods inherited from class java.util.random.RandomGenerator
getDefault, isDeprecated, nextExponential, of
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
-
Constructor Detail
-
KRandom
KRandom()
Create a new KRandom instance with default parameters.
-
KRandom
KRandom(KRandomParameters kRandomParameters)
Create a new KRandom instance.- Parameters:
kRandomParameters
- randomization parameters
-
-
Method Detail
-
nextObject
<T> T nextObject(Class<T> type)
Generate a random instance of the given type.
- Parameters:
type
- the type for which an instance will be generated- Returns:
a random instance of the given type
-
-
-
-