java.lang.Object
rodeo.password.pgencheck.DefaultUIntGenerator
- All Implemented Interfaces:
RandomUIntGenerator
A default implementation of
RandomUIntGenerator
. This class is used if no implementation of
RandomUIntGenerator
is provided to PasswordMaker.Factory
.
This class use ThreadLocalRandom.current()
internally.
-
Field Summary
Modifier and TypeFieldDescriptionstatic final RandomUIntGenerator
A sharable instance ofRandomUIntGenerator
. -
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionint
getNextUInt
(int max) Generate a random integer between 0 andmax
(not included).random()
Returns ajava.util.Random
object.
-
Field Details
-
GENERATOR
A sharable instance ofRandomUIntGenerator
.
-
-
Constructor Details
-
DefaultUIntGenerator
public DefaultUIntGenerator()Create aDefaultUIntGenerator
instance.
-
-
Method Details
-
getNextUInt
public int getNextUInt(int max) Generate a random integer between 0 andmax
(not included).- Specified by:
getNextUInt
in interfaceRandomUIntGenerator
- Parameters:
max
- the upper-bound (not included) of generated integers- Returns:
- a random integer between 0 and
max
(not included) - Throws:
IllegalArgumentException
- ifmax < 2
- See Also:
-
random
Returns ajava.util.Random
object.- Specified by:
random
in interfaceRandomUIntGenerator
- Returns:
- a
java.util.Random
object - See Also:
-