fillNumbers function

void fillNumbers(
  1. List<int> list, {
  2. int start = 0,
  3. int? length,
  4. RNG generator = RNG.secure,
})

Fills the list with random 32-bit numbers.

Both the start and length are in bytes.

Implementation

void fillNumbers(
  List<int> list, {
  int start = 0,
  int? length,
  RNG generator = RNG.secure,
}) {
  int n = length ?? list.length;
  if (n == 0) return;
  var rand = HashlibRandom(generator);
  for (; n > 0 && start < list.length; ++start, --n) {
    list[start] = rand.nextInt();
  }
}