Gathering detailed insights and metrics for @freddyheppell/random-prime
Gathering detailed insights and metrics for @freddyheppell/random-prime
Gathering detailed insights and metrics for @freddyheppell/random-prime
Gathering detailed insights and metrics for @freddyheppell/random-prime
npm install @freddyheppell/random-prime
Typescript
Module System
Node Version
NPM Version
JavaScript (100%)
Total Downloads
0
Last Day
0
Last Week
0
Last Month
0
Last Year
0
MIT License
55 Commits
16 Branches
1 Contributors
Updated on Jan 22, 2022
Latest Version
2.0.0
Package Id
@freddyheppell/random-prime@2.0.0
Unpacked Size
10.96 kB
Size
4.46 kB
File Count
9
NPM Version
8.1.4
Node Version
17.2.0
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
⚠️ This fork has been deprecated as the original
random-prime
library has been fixed. Consider using it instead ⚠️
Generate a random prime number
This uses Math.random
internally.
npm i @freddyheppell/random-prime --save
1const randomPrime = require('random-prime').randomPrime; 2 3console.log(randomPrime()); 4// 254205915209711 5console.log(randomPrime(500)); 6// 119 7console.log(randomPrime(200, 800)); 8// 413
Generate a random prime number from 0 to Number.MAX_SAFE_INTEGER
.
Returns a prime number
Generate a random prime number from 0
to max
.
Returns a prime number or null if
max
< 2
Throws TypeError ifmax
is not a Number
Generate a random prime number from min
to max
.
Returns a prime number or null if there is no prime number between
min
andmax
Throws TypeError ifmin
and/ormax
is not a Number
An efficient method to check i a number is prime.
Returns true if
num
is prime, false ifnum
is not prime.
Throws TypeError if input is not a Number
1const isPrime = require('random-prime').isPrime; 2 3console.log(isPrime(2)); 4// true 5console.log(isPrime(254205915209711)); 6// true 7console.log(isPrime(500)); 8// false 9console.log(isPrime(-10)); 10// false 11console.log(isPrime(137)); 12// true
No vulnerabilities found.
Reason
no dangerous workflow patterns detected
Reason
security policy file detected
Details
Reason
no binaries found in the repo
Reason
license file detected
Details
Reason
SAST tool detected but not run on all commits
Details
Reason
dependency not pinned by hash detected -- score normalized to 1
Details
Reason
0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0
Reason
detected GitHub workflow tokens with excessive permissions
Details
Reason
Found 0/20 approved changesets -- score normalized to 0
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
project is not fuzzed
Details
Reason
branch protection not enabled on development/release branches
Details
Reason
39 existing vulnerabilities detected
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