getInt static method
Generates a random integer within the specified range.
Parameters:
max
: The maximum value (exclusive).min
: The minimum value (inclusive). Default is 0.seed
: Seed for the random number generator. Default is null.
Example:
int randomInt = RandomProvider.getInt(max: 10, min: 5, seed: 42);
// Result: Random integer between 5 (inclusive) and 10 (exclusive).
Implementation
static int getInt({
required int max,
int min = 0,
int? seed,
}) {
return Random(seed).nextInt(max - min) + min;
}