Gathering detailed insights and metrics for random-seed
Gathering detailed insights and metrics for random-seed
Gathering detailed insights and metrics for random-seed
Gathering detailed insights and metrics for random-seed
GRC's UHE PRNG in node (Ultra-High Entropy Pseudo-Random Number Generator by Gibson Research Corporation)
npm install random-seed
Typescript
Module System
Min. Node Version
Node Version
NPM Version
JavaScript (100%)
Total Downloads
0
Last Day
0
Last Week
0
Last Month
0
Last Year
0
NOASSERTION License
94 Stars
7 Commits
8 Forks
3 Watchers
2 Branches
1 Contributors
Updated on Dec 18, 2024
Latest Version
0.3.0
Package Id
random-seed@0.3.0
Size
29.29 kB
NPM Version
3.3.12
Node Version
5.1.0
Published on
Nov 27, 2015
Cumulative downloads
Total Downloads
Last Day
0%
NaN
Compared to previous day
Last Week
0%
NaN
Compared to previous week
Last Month
0%
NaN
Compared to previous month
Last Year
0%
NaN
Compared to previous year
1
7
Gibson Research Corporation's Ultra-High Entropy Pseudo-Random Number Generator ported to node.
The original library / project page is located here: https://www.grc.com/otg/uheprng.htm
The node project page is here: https://github.com/skratchdot/random-seed
There were a few modifications made to the original library to allow seeding, and to pass jshint.
I've also added the following helper methods:
Install the module with: npm install random-seed
1var rand = require('random-seed').create(); 2var n = rand(100); // generate a random number between 0 - 99
1var gen = require('random-seed'); // create a generator 2 3// these generators produce different numbers 4var rand1 = gen.create(); // method 1 5var rand2 = new gen(); // method 2 6var rand3 = gen(); // method 3 7 8// these generators will produce 9// the same sequence of numbers 10var seed = 'My Secret String Value'; 11var rand4 = gen.create(seed); 12var rand5 = new gen(seed); 13var rand6 = gen(seed);
Once a random generator is created, you have the following methods available.
I typically create a random generator like this:
1var rand = require('random-seed').create();
Returns a random integer between 0 (inclusive) and range (exclusive)
Returns a random integer between 0 (inclusive) and range (exclusive)
Returns a random float between 0 (inclusive) and 1 (exclusive)
Works the same as Math.random()
Returns a random float between min (inclusive) and max (exclusive)
Returns a random integer between min (inclusive) and max (inclusive)
Same as calling rand.initState() followed by rand.hashString(seed). If seed is not a string, then the seed value will be converted to a string. If you don't pass a seed argument, then the generator uses Math.random() as the seed.
Returns a pseudo-random string of 'count' printable characters ranging from chr(33) to chr(126) inclusive.
Removes leading and trailing spaces and non-printing control characters, including any embedded carriage-return (CR) and line-feed (LF) characters, from any string it is handed. This is also used by the 'hashstring' function (below) to help users always obtain the same EFFECTIVE uheprng seeding key.
Hashes the provided character string after first removing any leading or trailing spaces and ignoring any embedded carriage returns (CR) or Line Feeds (LF).
This handy exported function is used to add entropy to our uheprng at any time.
If we want to provide a deterministic startup context for our PRNG, but without directly setting the internal state variables, this allows us to initialize the mash hash and PRNG's internal state before providing some hashing input.
We use this (optional) exported function to signal the JavaScript interpreter that we're finished using the internal "Mash" hash function so that it can free up the local "instance variables" it will have been maintaining. It's not strictly necessary, of course, but it's good JavaScript citizenship.
1var rand = require('random-seed').create(); 2var n = rand(100); // generate a random number between 0 - 99
1var rand = require('random-seed').create(); 2rand.initState(); 3var n1 = rand(100); // n1 === 58 4var n2 = rand(100); // n2 === 26 5rand.initState(); // re-init 6var n3 = rand(100); // n3 === 58 && n3 === n1
1var rand1 = require('random-seed').create(), 2 rand2 = require('random-seed').create(); 3console.log(rand1(100), rand2(100));
1var seed = 'Hello World', 2 rand1 = require('random-seed').create(seed), 3 rand2 = require('random-seed').create(seed); 4console.log(rand1(100), rand2(100));
1var math = require('random-seed').create(); 2console.log(math.random());
Copyright (c) 2013 skratchdot
Dual Licensed under the MIT license and the original Public Domain License by GRC.
No vulnerabilities found.
Reason
no binaries found in the repo
Reason
0 existing vulnerabilities detected
Reason
license file detected
Details
Reason
Found 0/7 approved changesets -- score normalized to 0
Reason
0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0
Reason
no SAST tool detected
Details
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
security policy file not detected
Details
Reason
project is not fuzzed
Details
Reason
branch protection not enabled on development/release branches
Details
Score
Last Scanned on 2025-07-07
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn More