1.0.10 • Published 3 years ago

crypto-secure-random-digit v1.0.10

Weekly downloads
8,524
License
MIT
Repository
github
Last release
3 years ago

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]
1.0.10

3 years ago

1.0.9

4 years ago

1.0.8

5 years ago

1.0.7

5 years ago

1.0.6

5 years ago

1.0.5

5 years ago

1.0.4

5 years ago

1.0.3

5 years ago

1.0.2

5 years ago

1.0.1

5 years ago

1.0.0

5 years ago