- java.lang.Object
-
- rodeo.password.pgencheck.DefaultUIntGenerator
-
- All Implemented Interfaces:
RandomUIntGenerator
public final class DefaultUIntGenerator extends Object implements RandomUIntGenerator
A default implementation ofRandomUIntGenerator. This class is used if no implementation ofRandomUIntGeneratoris provided toPasswordMaker.Factory.This class use
ThreadLocalRandom.current()internally.
-
-
Field Summary
Fields Modifier and Type Field Description static RandomUIntGeneratorGENERATORA sharable instance ofRandomUIntGenerator.
-
Constructor Summary
Constructors Constructor Description DefaultUIntGenerator()Create aDefaultUIntGeneratorinstance.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description intgetNextUInt(int max)Generate a random integer between 0 andmax(not included).Randomrandom()Returns ajava.util.Randomobject.
-
-
-
Field Detail
-
GENERATOR
public static final RandomUIntGenerator GENERATOR
A sharable instance ofRandomUIntGenerator.
-
-
Method Detail
-
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:
PasswordMaker.Factory.setRandomUIntGenerator(RandomUIntGenerator)
-
random
public Random random()
Returns ajava.util.Randomobject.- Specified by:
randomin interfaceRandomUIntGenerator- Returns:
- a
java.util.Randomobject - See Also:
PasswordMaker.Factory.setRandomUIntGenerator(RandomUIntGenerator),PasswordMaker.create()
-
-