public class Randomization
extends java.lang.Object
| Constructor and Description |
|---|
Randomization() |
| Modifier and Type | Method and Description |
|---|---|
static java.util.Random |
getGenerator() |
static double |
randBetween(double d1,
double d2)
Return a uniform random double between (including) d1 and (not including) d2
|
static int |
randBetween(int i1,
int i2)
Return a uniform random number between (including) i1 and (not including) i2.
|
static void |
randomizeInPlace(int[] as)
Randomize an array.
|
static int[] |
randomPermutation(int max)
Generate a random permutation of integers between (including) 0 and (not including) max
|
static void |
seed(long s)
Seeds the random generater used by this class.
|
static java.lang.Object[] |
shuffle(java.lang.Object[] arr) |
public static java.util.Random getGenerator()
public static int randBetween(int i1,
int i2)
i1 - lower bound of random numberi2 - upper bound of random numberpublic static double randBetween(double d1,
double d2)
d1 - lower bound of random numberd2 - upper bound of random numberpublic static int[] randomPermutation(int max)
max - the length of the permutationpublic static void randomizeInPlace(int[] as)
as - the array to be randomizedpublic static void seed(long s)
s - seedpublic static java.lang.Object[] shuffle(java.lang.Object[] arr)