expo-random
provides a native interface for creating strong random bytes. With Random
you can create values equivalent to Node.js
core crypto.randomBytes
API. expo-random
also works with expo-standard-web-crypto
, which implements the W3C Crypto API for generating random bytes.Android Device | Android Emulator | iOS Device | iOS Simulator | Web |
---|---|---|---|---|
expo install expo-random
If you're installing this in a bare React Native app, you should also follow these additional installation instructions.
import * as Random from 'expo-random';
byteCount
property is a number
indicating the number of bytes to generate in the form of a Uint8Array
.TypeError
.byteCount
.byteCount
property is a number
indicating the number of bytes to generate in the form of a Uint8Array
.TypeError
.byteCount
.