|
MOEA Framework 2.12 API Specification |
|||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.moeaframework.core.PRNG
public class PRNG
Static methods for generating random or pseudo-random numbers. Any source of
randomness implementing the Random
interface can be used as the
random source.
PRNG
relies on an underlying source of randomness, and inherits
thread safety from the underlying implementation. Unless the underlying
implementation is known to be thread-safe, assume that PRNG
is not
thread-safe.
Method Summary | ||
---|---|---|
static Random |
getRandom()
Returns the source of randomness currently used. |
|
static boolean |
nextBoolean()
Returns the next random, uniformly distributed boolean value. |
|
static double |
nextDouble()
Returns the next random, uniformly distributed double value
between 0.0 and 1.0. |
|
static double |
nextDouble(double min,
double max)
Returns the next random, uniformly distributed double value
between min and max . |
|
static float |
nextFloat()
Returns the next random, uniformly distributed float value
between 0.0 and 1.0. |
|
static float |
nextFloat(float min,
float max)
Returns the next random, uniformly distributed float value
between min and max . |
|
static double |
nextGaussian()
Returns the next random, Gaussian distributed double value with
mean 0.0 and standard deviation 1.0 . |
|
static double |
nextGaussian(double mean,
double stdev)
Returns the next random, Gaussian distributed double value with
mean mean and standard deviation stdev . |
|
static int |
nextInt()
Returns the next random, uniformly distributed int value between
Integer.MIN_VALUE and Integer.MAX_VALUE . |
|
static int |
nextInt(int n)
Returns the next random, uniformly distributed int value between
0 (inclusive) and n (exclusive). |
|
static int |
nextInt(int min,
int max)
Returns the next random, uniformly distributed int value between
min and max (both inclusive). |
|
static
|
nextItem(List<T> list)
Returns a randomly selected item from the specified list. |
|
static void |
setRandom(Random random)
Sets the source of randomness to be used. |
|
static void |
setSeed(long seed)
While the preferred method for seeding PRNGs is through the setRandom method since methods providing more entropy may be
available
to specific implementations, this method is intended to provide a uniform
interface for setting the seed. |
|
static void |
shuffle(boolean[] array)
Shuffles the elements of the specified array using the same algorithm as Collections.shuffle(java.util.List>) . |
|
static void |
shuffle(byte[] array)
Shuffles the elements of the specified array using the same algorithm as Collections.shuffle(java.util.List>) . |
|
static void |
shuffle(double[] array)
Shuffles the elements of the specified array using the same algorithm as Collections.shuffle(java.util.List>) . |
|
static void |
shuffle(float[] array)
Shuffles the elements of the specified array using the same algorithm as Collections.shuffle(java.util.List>) . |
|
static void |
shuffle(int[] array)
Shuffles the elements of the specified array using the same algorithm as Collections.shuffle(java.util.List>) . |
|
static
|
shuffle(List<T> list)
Shuffles the elements of the specified list by invoking the Collections.shuffle(java.util.List>) method with the internal Random in
this PRNG. |
|
static void |
shuffle(long[] array)
Shuffles the elements of the specified array using the same algorithm as Collections.shuffle(java.util.List>) . |
|
static void |
shuffle(short[] array)
Shuffles the elements of the specified array using the same algorithm as Collections.shuffle(java.util.List>) . |
|
static
|
shuffle(T[] array)
Shuffles the elements of the specified array using the same algorithm as Collections.shuffle(java.util.List>) . |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Method Detail |
---|
public static void setSeed(long seed)
setRandom
method since methods providing more entropy may be
available
to specific implementations, this method is intended to provide a uniform
interface for setting the seed.
seed
- the new seedpublic static void setRandom(Random random)
random
- the source of randomness to be usedpublic static Random getRandom()
public static float nextFloat()
float
value
between 0.0 and 1.0.
float
value
between 0.0 and 1.0public static float nextFloat(float min, float max)
float
value
between min
and max
.
float
value
between min
and max
public static double nextDouble()
double
value
between 0.0 and 1.0.
double
value
between 0.0 and 1.0public static double nextDouble(double min, double max)
double
value
between min
and max
.
double
value
between min
and max
public static int nextInt()
int
value between
Integer.MIN_VALUE
and Integer.MAX_VALUE
.
int
value between
Integer.MIN_VALUE
and Integer.MAX_VALUE
.public static int nextInt(int n)
int
value between
0
(inclusive) and n
(exclusive).
int
value between
0
(inclusive) and n
(exclusive).public static int nextInt(int min, int max)
int
value between
min
and max
(both inclusive).
int
value between
min
and max
(both inclusive).public static boolean nextBoolean()
boolean
value.
boolean
value.public static double nextGaussian()
double
value with
mean 0.0
and standard deviation 1.0
.
double
value with
mean 0.0
and standard deviation 1.0
.public static double nextGaussian(double mean, double stdev)
double
value with
mean mean
and standard deviation stdev
.
double
value with
mean mean
and standard deviation stdev
.public static <T> void shuffle(T[] array)
Collections.shuffle(java.util.List>)
.
T
- the type of element stored in the arrayarray
- the array to be shuffledpublic static void shuffle(double[] array)
Collections.shuffle(java.util.List>)
.
array
- the array to be shuffledpublic static void shuffle(float[] array)
Collections.shuffle(java.util.List>)
.
array
- the array to be shuffledpublic static void shuffle(long[] array)
Collections.shuffle(java.util.List>)
.
array
- the array to be shuffledpublic static void shuffle(int[] array)
Collections.shuffle(java.util.List>)
.
array
- the array to be shuffledpublic static void shuffle(short[] array)
Collections.shuffle(java.util.List>)
.
array
- the array to be shuffledpublic static void shuffle(byte[] array)
Collections.shuffle(java.util.List>)
.
array
- the array to be shuffledpublic static void shuffle(boolean[] array)
Collections.shuffle(java.util.List>)
.
array
- the array to be shuffledpublic static <T> void shuffle(List<T> list)
Collections.shuffle(java.util.List>)
method with the internal Random
in
this PRNG.
T
- the type of elements stored in the listlist
- the list to be shuffledpublic static <T> T nextItem(List<T> list)
T
- the type of the elements stored in the listlist
- the list from which the item is randomly selected
|
MOEA Framework 2.12 API Specification |
|||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |