
Research
Malicious npm Packages Impersonate Flashbots SDKs, Targeting Ethereum Wallet Credentials
Four npm packages disguised as cryptographic tools steal developer credentials and send them to attacker-controlled Telegram infrastructure.
random-nodejs
Advanced tools
A simple and flexible npm library that creates various type of Random Numbers.
A simple and flexible npm library that creates various type of Random Numbers and String.
Works in both NodeJS and the browser.
npm i random-nodejs --save
var rand = require("random-nodejs");
Return, Random float numbers.
rand.random(baseNum, fixedNum);
baseNum represent base of the number system.
Default is 1
Specified baseNum as 1, 10, 100, 1000 ...
fixedNum represent max length of output float number.
rand.random(1, 5) // Ex. output 0.41008, 0.89666
rand.random(10, 5) // Ex. output 6.30851, 5.64046
rand.random(100, 5) // Ex. output 44.75786, 30.95153
rand.random(1000, 3) // Ex. output 422.649, 437.101
Return, Random true or false values.
rand.bool(thresholdNum);
Specified thresholdNum between 0 and 1
Default is 0.5
When thresholdNum = 0.5, Get true => 50%, false => 50%
When thresholdNum = 0.3, Get true => 30%, false => 70%
rand.bool(0.8) // Ex. output true, true, true, false
rand.bool(0.2) // Ex. output true, false, false, false
Return, Random integer numbers between min and max values.
rand.intnum(min, max);
Default min = 0
Default max = 1
rand.intnum(-5, 10) // Ex. output 2 , 0, 3, -5
rand.intnum(-15, -5) // Ex. output -4 , -10, -8, -5
Return, Random float numbers between min and max values.
rand.floatnum(min, max, fixedNum);
Specified fixedNum to get max length of output float number.
Default min = 0
Default max = 1
rand.floatnum(-5, 10, 5) // Ex. output -4.92252, 9.29047, 9.30004, -2.33519
rand.floatnum(-5, 10, 2) // Ex. output 1.56, -3.43 7.33
Return, Random numbers inside the user-defined array of numbers.
const arr = ([1, 2, 3, 4]);
random.option(arr); // Ex. output 3, 1, 4, 1, 2
Return, Random numbers in multiples of a number(mutiples of mul value) in between min and max values.
rand.multiples(min, max, mul);
Default mul = 0.1
Default min = 0
Default max = 1
rand.multiples(-10, 10, 2) // Ex. output -4, 6, -8, 10
rand.multiples(-10, 10, 0.2) // Ex. output 10, -1.4, -2.8, 6.4
Return, Capital letters.
rand.capital();
Ex. Output A, Z, E, C ...
Return, Simple letters.
rand.simple();
Ex. Output g, j, l, o ...
Return, Random Words inside the user-defined array of words.
var things = ['Rock', 'Paper', 'Scissor'];
rand.words(things);
Ex. Output Paper, Scissor, Rock, Rock ...
You can contribute to this project.
You just need to create a pull request which will be revised, merged to main branch (if the code doesn't break the project) and published as a new release.
FAQs
A simple and flexible npm library that creates various type of Random Numbers.
The npm package random-nodejs receives a total of 10 weekly downloads. As such, random-nodejs popularity was classified as not popular.
We found that random-nodejs 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
Four npm packages disguised as cryptographic tools steal developer credentials and send them to attacker-controlled Telegram infrastructure.
Security News
Ruby maintainers from Bundler and rbenv teams are building rv to bring Python uv's speed and unified tooling approach to Ruby development.
Security News
Following last week’s supply chain attack, Nx published findings on the GitHub Actions exploit and moved npm publishing to Trusted Publishers.