1.2.1 • Published 5 years ago
luckyy v1.2.1
Luckyy
A small utility library to expand on the random method of the default JavaScript Math object.
Installation
You can install it in your project file and use it as a dependency.
npm install luckyyUsage
You can import it in your prpject using CommonJs Modules.
Common Js
This mini utility contains two sections. One for whole numbers and the other for Decimals.
// Destructuring the main object.
const { randReal, randDec } = require("luckyy");
// randReal for whole numbers
// randDec for decimal numbersMethods
Real Numbers
| Method | Use | Parameters |
|---|---|---|
rand() | Return a single whole random number | limit (optional) - The highest random number you can generate. Default is 10 |
randArray() | Return an array of whole random numbers | limit (optional) - The highest random in the array. Default - 10 arrLen (optional) - The length of the array. Default - 10 |
randArrayRange() | Return an array of a range of whole numbers | start (required) - The lowest random number in the array limit (required when less than start) - The highest random number in the array. Default - 10 arrLen (optional) - The length of the array. Default - 10 |
Decimal Numbers
| Method | Use | Parameters |
|---|---|---|
rand() | Return a single whole random number | dp (optional) - Number of decimal places. Default - 3 limit (optional) - The highest random number you can generate. Default is 10 |
randArray() | Return an array of whole random numbers | arrLen (optional) - The length of the array. Default - 10 dp (optional) - Number of decimal places. Default - 3 limit (optional) - The highest random in the array. Default - 10 |
randArrayRange() | Return an array of a range of whole numbers | start (required) - The lowest random number in the array limit (required when less than start) - The highest random number in the array. Default - 10 arrLen (optional) - The length of the array. Default - 10 dp (optional) - Number of decimal places. Default - 3 |
Contributing
Please submit a pull request if you want to, I'll be glad to merge them