secureRandomBytes function

Uint8List secureRandomBytes(
  1. int length
)

Returns length bytes from the platform's cryptographically secure RNG.

Implementation

Uint8List secureRandomBytes(int length) {
  final out = Uint8List(length);
  for (var i = 0; i < length; i++) {
    out[i] = _secure.nextInt(256);
  }
  return out;
}