# @pulumi/random

> A Pulumi package to safely use randomness in Pulumi programs.

Latest version **4.21.2** (published 2026-09-17) · Apache-2.0 license · 633.6K weekly downloads

## Install

```sh
npm install @pulumi/random
pnpm add @pulumi/random
yarn add @pulumi/random
bun add @pulumi/random
```

## Health

**Score 75/100 (B)** — status: active.

Positive: moderate downloads; has types; no vulnerabilities; recently updated; high maintenance score.

Warnings: no esm support.

## Facts

| | |
|---|---|
| Version | 4.21.2 |
| Published | 2026-09-17 |
| First published | 2018-10-26 |
| Weekly downloads | 633.6K |
| License | Apache-2.0 |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 1 |
| Unpacked size | 183.5 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 43 |
| Maintainers | joeduffy, pulumi-bot |
| Keywords | pulumi, random |

## Links

- npm: https://www.npmjs.com/package/@pulumi/random
- Repository: https://github.com/pulumi/pulumi-random
- Homepage: https://pulumi.io
- Issues: https://github.com/pulumi/pulumi-random/issues
- npm.io page: https://npm.io/package/@pulumi/random

## Dependencies (1)

- [@pulumi/pulumi](https://npm.io/package/@pulumi/pulumi.md) ^3.142.0

## Recent versions

- 4.21.2 (latest) — 2026-09-17
- 4.22.0-alpha.1789713131 (dev) — 2026-09-18
- 4.0.0-rc.1 (rc) — 2021-04-16
- 4.0.0-alpha.1618568201 (feature-3.0) — 2021-04-16
- 4.0.0-beta.2 (beta) — 2021-04-08
- 2.1.0-alpha.1586887471 (feature-2.0) — 2020-04-14
- 1.2.0-alpha.1570925708 (feature-synchronousInvokes2) — 2019-10-13
- 1.0.1-alpha.1568309515 (feature-double-publish-testing) — 2019-09-12
- 1.0.1-alpha.1566436250 (feature-python-constraint) — 2019-08-22
- 0.5.1-dev.1551916746 (feature-all) — 2019-03-07
- 4.21.2-alpha.1789640677 — 2026-09-17
- 4.22.0-alpha.1789108526 — 2026-09-11
- 4.22.0-alpha.1788848549 — 2026-09-08
- 4.22.0-alpha.1788532781 — 2026-09-04
- 4.22.0-alpha.1788503102 — 2026-09-04
- … 799 more at https://npm.io/package/@pulumi/random/versions

## README

[![Actions Status](https://github.com/pulumi/pulumi-random/workflows/master/badge.svg)](https://github.com/pulumi/pulumi-random/actions)
[![Slack](http://www.pulumi.com/images/docs/badges/slack.svg)](https://slack.pulumi.com)
[![NPM version](https://badge.fury.io/js/%40pulumi%2Frandom.svg)](https://npmjs.com/package/@pulumi/random)
[![NuGet version](https://badge.fury.io/nu/pulumi.random.svg)](https://badge.fury.io/nu/pulumi.random)
[![Python version](https://badge.fury.io/py/pulumi-random.svg)](https://pypi.org/project/pulumi-random)
[![PkgGoDev](https://pkg.go.dev/badge/github.com/pulumi/pulumi-random/sdk/v4/go)](https://pkg.go.dev/github.com/pulumi/pulumi-random/sdk/v4/go)
[![License](https://img.shields.io/npm/l/%40pulumi%2Fpulumi.svg)](https://github.com/pulumi/pulumi-random/blob/master/LICENSE)

# Random Provider

The random provider allows the safe use of randomness in a Pulumi program. This allows you to generate resource
properties, such as names, that contain randomness in a way that works with Pulumi's goal state oriented approach.
Using randomness as usual would not work well with Pulumi, because by definition, each time the program is evaluated,
a new random state would be produced, necessitating re-convergence on the goal state. This provider understands
how to work with the Pulumi resource lifecycle to accomplish randomness safely and in a way that works as desired.

## Installing

This package is available in many languages in the standard packaging formats.

### Node.js (Java/TypeScript)

To use from JavaScript or TypeScript in Node.js, install using either `npm`:

    $ npm install @pulumi/random

or `yarn`:

    $ yarn add @pulumi/random

### Python

To use from Python, install using `pip`:

    $ pip install pulumi_random

### Go

To use from Go, use `go get` to grab the latest version of the library

    $ go get github.com/pulumi/pulumi-random/sdk/v4/go/...

### .NET

To use from .NET, install using `dotnet add package`:

    $ dotnet add package Pulumi.Random

## Example

For example, to generate a random password, allocate a `RandomPassword` resource
and then use its `result` output property (of type `Output<string>`) to pass
to another resource.

```typescript
import * as pulumi from "@pulumi/pulumi";
import * as aws from "@pulumi/aws";
import * as random from "@pulumi/random";

const password = new random.RandomPassword("password", {
    length: 16,
    overrideSpecial: "_%@",
    special: true,
});
const example = new aws.rds.Instance("example", {
    password: password.result,
});
```

## Reference

For further information, please visit [the random provider docs](https://www.pulumi.com/docs/intro/cloud-providers/random) or for detailed reference documentation, please visit [the API docs](https://www.pulumi.com/docs/reference/pkg/random).

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