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
FieldsModifier and TypeFieldDescriptionstatic final RandomUIntGeneratorA sharable instance ofRandomUIntGenerator. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionintgetNextUInt(int max) Generate a random integer between 0 andmax(not included).random()Returns ajava.util.Randomobject.
-
Field Details
-
GENERATOR
A sharable instance ofRandomUIntGenerator.
-
-
Constructor Details
-
DefaultUIntGenerator
public DefaultUIntGenerator()Create aDefaultUIntGeneratorinstance.
-
-
Method Details
-
getNextUInt
public int getNextUInt(int max) Generate a random integer between 0 andmax(not included).- Specified by:
getNextUIntin 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.Randomobject.- Specified by:
randomin interfaceRandomUIntGenerator- Returns:
- a
java.util.Randomobject - See Also:
-