randomBytes function

Uint8List randomBytes(
  1. int length, {
  2. Random? random,
})

Generates a list of length random bytes.

By default, cryptographically secure SecureRandom.fast is used.

Implementation

Uint8List randomBytes(int length, {Random? random}) {
  final bytes = Uint8List(length);
  fillBytesWithSecureRandom(bytes, random: random);
  return bytes;
}