public class Randomizer extends Object
Constructor and Description |
---|
Randomizer() |
Modifier and Type | Method and Description |
---|---|
static boolean |
probability(double p)
Returns true with a probability of p.
|
static double |
random(double min,
double max) |
static int |
random(int n)
Picks a random number between 0 (inclusive) and N (exclusive).
|
static int |
random(int min,
int max)
Picks a uniformly distributed random integer within the given range.
|
static String |
randomString(int... segments)
Generates a random alphanumeric String with each segment separated by a dash.
|
static <T> T |
selectRandom(List<T> list)
Picks a random element from the given list.
|
static <T> List<T> |
selectRandom(List<T> list,
int n)
Selects n elements randomly from the given list.
|
public static boolean probability(double p)
public static int random(int n)
public static int random(int min, int max)
public static double random(double min, double max)
public static String randomString(int... segments)
public static <T> T selectRandom(List<T> list)
Copyright © 2006–2018 Apache Software Foundation. All rights reserved.