New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

crypto-secure-random-digit

Package Overview
Dependencies
Maintainers
1
Versions
11
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

crypto-secure-random-digit

A Cryptographically Secure Pseudo-Random Number Generator for NodeJS

  • 1.0.10
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
9.2K
decreased by-16%
Maintainers
1
Weekly downloads
 
Created
Source

NOTICE

Since NodeJS v14.10.0, v12.19.0 there is crypto.randomInt(), you probably wanna use that.

(It actually has a similar implementation)

Cryptographically Secure Pseudo-Random Number Generator

Master Build Status

This is a node package for generating cryptographically secure random digits.

If you think "why do you need more than just crypto.randomBytes?" read this: https://gist.github.com/joepie91/7105003c3b26e65efcea63f3db82dfba

I wrote this module because I wanted something simple without any dependencies and with an implementation I can understand - and thus verify.

Usage:

const digitGenerator = require('crypto-secure-random-digit');

// Get one random digit
const randomDigit = digitGenerator.randomDigit();
console.log(randomDigit); // e.g. 4

// Get a list with 10 random digits:
const randomDigits = digitGenerator.randomDigits(10);
console.log(randomDigits); // e.g. [7, 1, 0, 0, 5, 9, 3, 8, 2, 7]

Keywords

FAQs

Package last updated on 27 Sep 2021

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc