Skip to main content
Using Deno in production at your company? Earn free Deno merch.
Give us feedback
Module

x/deno/cli/js/get_random_values.ts>getRandomValues

A modern runtime for JavaScript and TypeScript.
Go to Latest
function getRandomValues
import { getRandomValues } from "https://deno.land/x/deno@v0.30.0/cli/js/get_random_values.ts";

Synchronously collects cryptographically secure random values. The underlying CSPRNG in use is Rust's rand::rngs::ThreadRng.

  const arr = new Uint8Array(32);
  crypto.getRandomValues(arr);

Type Parameters

T extends
| Int8Array
| Uint8Array
| Uint8ClampedArray
| Int16Array
| Uint16Array
| Int32Array
| Uint32Array

Parameters

typedArray: T