randomInRange function

int randomInRange(
  1. num min,
  2. num max, [
  3. int? seed
])

Generates a random integer within the specified range.

Returns a random integer between min and max, inclusive.

If a seed is provided, it is used to initialize the random number generator for reproducible results. Example:

int randomNumber = randomInRange(1, 10);

Implementation

int randomInRange(num min, num max, [int? seed]) =>
    ((max - min + 1).random(seed) + min).toInt();