Package org.stubit.random
Class RandomNumber
java.lang.Object
org.stubit.random.RandomNumber
Generates random integers.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classRandomNumber.RandomNumberBuilderimplementation forIntegersstatic classRandomNumber.RandomNumberBuilderimplementation forLongsstatic interfaceInterface for any random number builder. -
Method Summary
Modifier and TypeMethodDescriptionstatic RandomNumber.RandomNumberBuilder<Long>aLong()static longaLongBetween(long minInclusive, long maxInclusive) static intstatic longanInt()static intanIntBetween(int minInclusive, int maxInclusive) static intstatic long
-
Method Details
-
anIntBetween
public static int anIntBetween(int minInclusive, int maxInclusive) - Parameters:
minInclusive- the minimum value (inclusive)maxInclusive- the maximum value (inclusive)- Returns:
- a random integer between
minInclusiveandmaxInclusive
-
aNegativeInt
public static int aNegativeInt()- Returns:
- a random integer between
Integer.MIN_VALUEand -1
-
aPositiveInt
public static int aPositiveInt()- Returns:
- a random integer between 1 and
Integer.MAX_VALUE- 1
-
anInt
- Returns:
- a
RandomNumber.RandomIntBuilderwithminInteger.MIN_VALUEandmaxInteger.MAX_VALUE- 1.
-
aLongBetween
public static long aLongBetween(long minInclusive, long maxInclusive) - Parameters:
minInclusive- the minimum value (inclusive)maxInclusive- the maximum value (inclusive)- Returns:
- a random long between
minInclusiveandmaxInclusive
-
aNegativeLong
public static long aNegativeLong()- Returns:
- a random long between
Long.MIN_VALUEand -1
-
aPositiveLong
public static long aPositiveLong()- Returns:
- a random long between 1 and
Long.MAX_VALUE- 1
-
aLong
- Returns:
- a
RandomNumber.RandomLongBuilderwithminLong.MIN_VALUEandmaxLong.MAX_VALUE- 1.
-