randBytes function

Uint8List randBytes(
  1. Random generator,
  2. int n
)

Returns n random bytes.

Implementation

Uint8List randBytes(Random generator, int n) {
  final Uint8List random = Uint8List(n);
  for (int i = 0; i < random.length; i++) {
    random[i] = generator.nextInt(255);
  }
  return random;
}