@npmextras/get-random-values

Cross browser and node.js implementation to generate random values.

Usage no npm install needed!

<script type="module">
  import npmextrasGetRandomValues from 'https://cdn.skypack.dev/@npmextras/get-random-values';
</script>

README

get-random-values

Cross browser and node.js implementation to generate random values.

Either uses:

  • window.crypto
  • window.msCrypto
  • node crypto

if it exists, otherwise throws.

Example

import getRandomValues from 'get-random-values';

const array = getRandomValues(new Uint32Array(4));
// [9, 50, 194, 143]

Installation

npm install github:ProtonMail/get-random-values.git#semver:^1.0.0