123456789101112131415161718192021222324252627282930313233343536373839404142 |
- package utility;
- public class Random {
-
-
- private static java.util.Random random = new java.util.Random();
-
- /**
- * True or false
- * @return the random boolean.
- */
- public static boolean nextBoolean(){
- return random.nextBoolean();
- }
- /**
- * Between 0.0(inclusive) and 1.0 (exclusive)
- * @return the random double.
- */
- public static double nextDouble() {
- return random.nextDouble();
- }
-
- public static float nextFloatInRange(float min, float max) {
- return min + random.nextFloat() * Math.abs(max - min);
- }
-
-
- public static double nextDoubleInRange(double min, double max) {
- return min + random.nextDouble() * Math.abs(max - min);
- }
-
- /**
- * Random Int in Range [min;max[ with UniformDistirbution
- * @param min
- * @param max
- * @return
- */
- public static int nextIntegerInRange(int min, int max) {
- return min + random.nextInt(max - min);
- }
-
- }
|