A collection of utilities generating anything random.
Pengrape provides 8 different utilities which include generating random number, color, palette, password, spinner, dice, text and date. Their behavior can be customized by providing different arguments.
$ npm install pengrape
const random = require("pengrape");
You can use the available methods to generate a random result according to your preferences.
random.number({ min: 10, max: 20 }); // 17
To generate multiple results, you can use the construct option in any methods you want.
random.number({ min: 10, max: 20, construct: 4 }); // [12, 14, 10, 19]
const color = random.color({ format: "hex" });
console.log(color); // "#f28e51"
const dice = random.dice({ notation: "2d10" });
console.log(dice); // { results: [ 4, 9 ], total: 13 }
const date = random.date({ dateStart: [2021, 1, 1], dateEnd: [2021, 6, 17] });
console.log(date); // "2021-04-29"
See the full docs for details and examples.
If any issues are found, they can be reported here.
This project is licensed under the MIT license.