Package org.stubit.random
Class RandomInt.RandomIntBuilder
java.lang.Object
org.stubit.random.RandomInt.RandomIntBuilder
- Enclosing class:
- RandomInt
Builds a random integer within a specified range.
-
Method Details
-
positive
- Returns:
- this
-
negative
SetsminInclusivetoInteger.MIN_VALUEand max to -1.- Returns:
- this
-
min
- Parameters:
minInclusive- the minimum value (inclusive)- Returns:
- this
- Throws:
IllegalArgumentException- ifminInclusiveis greater than or equal tomaxInclusive
-
max
- Parameters:
maxInclusive- the maximum value (inclusive)- Returns:
- this
- Throws:
IllegalArgumentException- ifmaxInclusiveis less than or equal tominInclusiveor ifmaxInclusiveis equal toInteger.MAX_VALUE
-
build
public int build()- Returns:
- a random integer between
minInclusiveandmaxInclusive
-