public final class RandomUtils extends Object
| Modifier and Type | Method and Description |
|---|---|
static void |
ownRandomImpl(RandomUtilImpl newImpl) |
static <T> T |
randomElement(Collection<T> elements)
It returns random element from collection.
|
static <T> T |
randomElement(T... elements)
It returns random element from array.
|
static <T> int |
randomIndex(List<T> elements)
It returns random index for element from collection.
|
static <T> int |
randomIndex(T... elements)
It returns random index for element from array.
|
static int |
randomInRange(int min,
int max)
Return random integer number.
|
static boolean |
randomTrue()
It returns true or false randomly.
|
static boolean |
randomTrue(int probabilityOfTrueInPercent)
It returns true or false randomly based on probability of true value of boolean.
|
public static void ownRandomImpl(RandomUtilImpl newImpl)
public static int randomInRange(int min,
int max)
min - returned valuemax - returned valuepublic static <T> int randomIndex(List<T> elements)
T - generic type for collection argument.elements - for random index.public static <T> int randomIndex(T... elements)
T - generic type for array argument.elements - for random index.public static <T> T randomElement(Collection<T> elements)
T - generic type for collection argument.elements - from which will be found random element.public static <T> T randomElement(T... elements)
T - generic type for array.elements - from which will be found random element.public static boolean randomTrue()
public static boolean randomTrue(int probabilityOfTrueInPercent)
Copyright © 2019. All rights reserved.