# expo-random

> Expo universal module for random bytes

Latest version **14.0.1** (published 2024-04-23) · MIT license · 0 weekly downloads

> **Deprecated.** This package is deprecated.

## Install

```sh
npm install expo-random
pnpm add expo-random
yarn add expo-random
bun add expo-random
```

## Health

**Score 10/100 (F)** — status: deprecated.

Negative: deprecated.

## Facts

| | |
|---|---|
| Version | 14.0.1 |
| Published | 2024-04-23 |
| First published | 2019-02-27 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 1 |
| Unpacked size | 29.5 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | 650 Industries, Inc. |
| Maintainers | radoslawkrzemien, pkham, szdziedzic, tsapeta, wkozyra, ide, lukmccall, alanhughes, kadikraman, aleqsio, marklawlor, gabrieldonadel, simek, keith-kurak, christopherwalter, kbrandwijk, fiber-god, brentvatne, evanbacon, quinlanj, expoadmin, exponent, wschurman, bycedric, jonsamp, princefleaswallow, kudochien |
| Keywords | react-native, expo, random, crypto, random-bytes, secure, generator, bytes |

## Links

- npm: https://www.npmjs.com/package/expo-random
- Repository: https://github.com/expo/expo
- Homepage: https://docs.expo.dev/versions/latest/sdk/random/
- Issues: https://github.com/expo/expo/issues
- npm.io page: https://npm.io/package/expo-random

## Dependencies (1)

- [base64-js](https://npm.io/package/base64-js.md) ^1.3.0

## Alternatives

- [@gemini-wallet/core](https://npm.io/package/@gemini-wallet/core.md) — 515.6K weekly downloads
- [utility](https://npm.io/package/utility.md) — 416.6K weekly downloads
- [@primno/dpapi](https://npm.io/package/@primno/dpapi.md) — 7.2K weekly downloads
- [pi-readseek](https://npm.io/package/pi-readseek.md) — 3.7K weekly downloads
- [@emilia-protocol/verify](https://npm.io/package/@emilia-protocol/verify.md) — 1.1K weekly downloads

## Recent versions

- 14.0.1 (latest) — 2024-04-23
- 0.0.1-canary-20240418-8d74597 (canary) — 2024-04-18
- 13.6.0 (sdk-50) — 2023-11-14
- 14.0.0 — 2024-04-18
- 0.0.1-canary-20240415-cca04d8 — 2024-04-15
- 0.0.1-canary-20240415-0868fc4 — 2024-04-15
- 0.0.1-canary-20240411-55a0085 — 2024-04-12
- 0.0.1-canary-20240411-33a7dc1 — 2024-04-11
- 0.0.1-canary-20240406-a4950c7 — 2024-04-06
- 0.0.1-canary-20240405-cdfd9c1 — 2024-04-05
- 0.0.1-canary-20240404-e2b8743 — 2024-04-04
- 0.0.1-canary-20240328-24ecc5e — 2024-03-28
- 0.0.1-canary-20240327-a7302d9 — 2024-03-27
- 0.0.1-canary-20240320-8a10e09 — 2024-03-20
- 0.0.1-canary-20240318-dd8f245 — 2024-03-18
- … 53 more at https://npm.io/package/expo-random/versions

## README

# expo-random

## ⚠️ Deprecated

This package is now deprecated in favor of `expo-crypto`, which provides the same functionality.
To migrate, replace all imports from `expo-random` with imports from `expo-crypto`.

Provides a native interface for creating strong random bytes. With `Random` you can generate random values to address use cases that other APIs like the web's `crypto.getRandomValues` and Node's `crypto.randomBytes` might address.

# Installation in managed Expo projects

For [managed](https://docs.expo.dev/archive/managed-vs-bare/) Expo projects, please follow the installation instructions in the [API documentation for the latest stable release](https://docs.expo.dev/versions/latest/sdk/random/).

You can add a polyfill for the web's `crypto.getRandomValues` by installing [expo-standard-web-crypto](https://github.com/expo/expo/tree/main/packages/expo-standard-web-crypto) and importing it in SDK 39 and higher:

```js
import { polyfillWebCrypto } from 'expo-standard-web-crypto';

polyfillWebCrypto();
// crypto.getRandomValues is now globally defined
```

Other libraries like [react-native-get-random-values](https://github.com/LinusU/react-native-get-random-values) may work too.

# Installation in bare React Native projects

For bare React Native projects, you must ensure that you have [installed and configured the `expo` package](https://docs.expo.dev/bare/installing-expo-modules/) before continuing.

### Add the package to your npm dependencies

```
npx expo install expo-random
```

### Configure for iOS

Run `npx pod-install` after installing the npm package.

### Configure for Android

No additional set up necessary.

---
_Source: https://npm.io/package/expo-random · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
