Skip to main content
Home
This release is 2 versions behind 0.1.4 — the latest version of @std/random. Jump to latest

@std/random@0.1.2
Built and signed on GitHub Actions

UNSTABLE: Various utilities using random number generators. The package also provides seeded pseudo-random number generator.

This package works with Cloudflare Workers, Node.js, Deno, Bun, Browsers
This package works with Cloudflare Workers
This package works with Node.js
This package works with Deno
This package works with Bun
This package works with Browsers
JSR Score
94%
Published
7 months ago (0.1.2)

Utilities for generating random numbers.

import { randomIntegerBetween } from "@std/random";
import { randomSeeded } from "@std/random";
import { assertEquals } from "@std/assert";

const prng = randomSeeded(1n);

assertEquals(randomIntegerBetween(1, 10, { prng }), 3);
Built and signed on
GitHub Actions

New Ticket: Report package

Please provide a reason for reporting this package. We will review your report and take appropriate action.

Please review the JSR usage policy before submitting a report.

Add Package

deno add jsr:@std/random

Import symbol

import * as random from "@std/random";
or

Import directly with a jsr specifier

import * as random from "jsr:@std/random";

Add Package

pnpm i jsr:@std/random
or (using pnpm 10.8 or older)
pnpm dlx jsr add @std/random

Import symbol

import * as random from "@std/random";

Add Package

yarn add jsr:@std/random
or (using Yarn 4.8 or older)
yarn dlx jsr add @std/random

Import symbol

import * as random from "@std/random";

Add Package

vlt install jsr:@std/random

Import symbol

import * as random from "@std/random";

Add Package

npx jsr add @std/random

Import symbol

import * as random from "@std/random";

Add Package

bunx jsr add @std/random

Import symbol

import * as random from "@std/random";