UNPKG

1.15 kBMarkdownView Raw
1# expo-random
2
3Provides a native interface for creating strong random bytes. With `Random` you can create values equivalent to `Node.js` core `crypto.randomBytes` API.
4
5# Installation in managed Expo projects
6
7For managed [managed](https://docs.expo.io/versions/latest/introduction/managed-vs-bare/) Expo projects, please follow the installation instructions in the [API documentation for the latest stable release](https://docs.expo.io/versions/latest/sdk/random/).
8
9You can add a polyfill for `crypto.getRandomValues` by installing [react-native-get-random-values](https://github.com/LinusU/react-native-get-random-values) and importing it in SDK 39 and higher.
10
11# Installation in bare React Native projects
12
13For bare React Native projects, you must ensure that you have [installed and configured the `react-native-unimodules` package](https://github.com/expo/expo/tree/master/packages/react-native-unimodules) before continuing.
14
15### Add the package to your npm dependencies
16
17```
18expo install expo-random
19```
20
21### Configure for iOS
22
23Run `npx pod-install` after installing the npm package.
24
25### Configure for Android
26
27No additional set up necessary.