simple-random-stuff
v1.0.5
Published
This package helps you to generate common random data(number, day, month, prime number, dice etc) quickly
Downloads
3
Maintainers
Readme
Simple Random Stuff
This package helps you to generate common random data(number, day, month, prime number, dice etc) quickly 😀
Features -
- 0 Dependencies
- Simple Number Generator - Ranged, Prime Number
- Random Day
- Random Month
- Coin Toss
- Dice Roll
- Hex Colors
- Rock, Paper, Scissor 😀
Installation -
- NPM -
npm i simple-random-stuff
Usage -
//named import
let {numRandomizer, simpleRandomizer, getDay} = require('simple-random-stuff')
//or whole import
let radomizers = require('simple-random-stuff')
// or you can use import as well(react, vue, angular etc)
import randomizers from 'simple-random-stuff'
//getting ranged random number
console.log(numRandomizer(5,20)) // 7
//getting simple random number, here 100 is the the upper range
console.log(simpleRandomizer(100)) // 57
//getting a random day
console.log(getDay()) // Monday
//getting a random month
console.log(radomizers.getMonth()) // July
//getting a coin toss result
console.log(radomizers.coinToss()) // Head
//getting a dice roll result
console.log(radomizers.diceRoll()) // 5
//getting a hex color
console.log(radomizers.getHexColor()) //#e80e53
//getting a random prime number
console.log(radomizers.getPrimeNumber(50,100, array=false)) // 53
//getting all the random prime numbers in a range
console.log(radomizers.getPrimeNumber(50,100, array=true)) // [53, 67 ....]
Thanks for your time, please give a star to this project 😁