New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

gb-random

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

gb-random

An alternative implementation of Math.random using crypto.getRandomBytes

latest
Source
npmnpm
Version
1.1.0
Version published
Maintainers
1
Created
Source

Build Status Coverage Status MIT license

gb-random

An alternative implementation of Math.random using crypto.getRandomBytes

Usage

npm install gb-random --save

const gbrandom = require("gb-random");

const rand = new gbrandom.Random();

// just replace Math.random with rand.getRandomSync
// console.log(Math.random(), "Math.random()");
console.log(rand.getRandomSync(), "gb-random");

// you can also use async
rand.getRandom().then(random => {
  console.log(random); // 0.3879
});

// or even better in an async function
const rando = await rnd.getRandom();
console.log(rando);

rand.getRandoms(3).then(randoms => {
  console.log(randoms); // [ 0.3879, 0.9659, 0.3019 ]
});

Keywords

Math

FAQs

Package last updated on 22 Jul 2017

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts