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
68.3
Supply Chain
86.8
Quality
75.5
Maintenance
100
Vulnerability
100
License
JavaScript (100%)
Total Downloads
2,291
Last Day
1
Last Week
1
Last Month
10
Last Year
156
55 Commits
1 Watching
16 Branches
1 Contributors
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%
1
Compared to previous day
Last week
0%
1
Compared to previous week
Last month
900%
10
Compared to previous month
Last year
-49.7%
156
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 binaries found in the repo
Reason
no dangerous workflow patterns detected
Reason
security policy file detected
Details
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
Found 0/20 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
detected GitHub workflow tokens with excessive permissions
Details
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
34 existing vulnerabilities detected
Details
Score
Last Scanned on 2024-12-23
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