Klasse CustomGenerators.IntRandomNumberGenerator
java.lang.Object
ch.framedev.simplejavautils.CustomGenerators.IntRandomNumberGenerator
- Umschließende Klasse:
CustomGenerators
A nested class that generates random integers within a specified range.
-
Konstruktorübersicht
KonstruktorenKonstruktorBeschreibungInitializes a new instance of theIntRandomNumberGeneratorclass.IntRandomNumberGenerator(int min, int max) Initializes a new random number generator that generates random integers within the specified range. -
Methodenübersicht
Modifizierer und TypMethodeBeschreibungintgetMax()Gets the maximum value for the random integer generation.intgetMin()Gets the minimum value for the random integer generation.intnextInt()Generates a random integer within the specified range.setMax(int max) Sets the maximum value for the random integer generation.setMin(int min) Sets the minimum value for the random integer generation.
-
Konstruktordetails
-
IntRandomNumberGenerator
public IntRandomNumberGenerator()Initializes a new instance of theIntRandomNumberGeneratorclass. -
IntRandomNumberGenerator
public IntRandomNumberGenerator(int min, int max) Initializes a new random number generator that generates random integers within the specified range.- Parameter:
min- the minimum value inclusivemax- the maximum value inclusive
-
-
Methodendetails
-
setMin
Sets the minimum value for the random integer generation.- Parameter:
min- the minimum value inclusive- Gibt zurück:
- this instance for method chaining
-
setMax
Sets the maximum value for the random integer generation.- Parameter:
max- the maximum value inclusive- Gibt zurück:
- this instance for method chaining
-
getMin
public int getMin()Gets the minimum value for the random integer generation.- Gibt zurück:
- the minimum value inclusive
-
getMax
public int getMax()Gets the maximum value for the random integer generation.- Gibt zurück:
- the maximum value inclusive
-
nextInt
public int nextInt()Generates a random integer within the specified range.- Gibt zurück:
- a random integer within the specified range
-