Research
Security News
Malicious npm Packages Inject SSH Backdoors via Typosquatted Libraries
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
random-array
Advanced tools
Generating array of random numbers
npm install random-array
var random = require('random-array');
//Generate array of size 10 between 1 and 10
random(1,10).oned(10);
//Generate array of width 3 and height 2 between 1 and 10
random(1,10).twod(3,2);
//Generate array of size 10 and round numbers between 1 and 10
random(1,10).oned(10, {round: true});
Generate array of random numbers, while function is false.
var random = require('random-array');
random(1,10).genWhile(function(x){ return Math.round(x) > 8;});
and output:
[ 4.424256478203461,
4.920260030310601,
4.706073637586087,
5.157449695048854,
9.543757784646004 ]
Because was found value 9.5437, function returns true and generation was stopped.
You can limit number of generation values:
random(1,10).genWhile(function(x){ return x === 11;}, {limit: 10});
MIT
FAQs
Create array with random numbers
The npm package random-array receives a total of 0 weekly downloads. As such, random-array popularity was classified as not popular.
We found that random-array demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
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.
Research
Security News
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
Security News
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
Security News
In this segment of the Risky Business podcast, Feross Aboukhadijeh and Patrick Gray discuss the challenges of tracking malware discovered in open source softare.