npm.io
1.0.1 • Published 5 years ago

lucky-winner

Licence
MIT
Version
1.0.1
Deps
0
Size
4 kB
Vulns
0
Weekly
0
Stars
2

��# lucky-winner A JS module for picking K random names from an array of N names.

where 1<=K<=N

Install

npm i lucky-winner

Usage

const luckyWinner = require('lucky-winner');
// luckyWinner(names,K=1) names:array and K:integer
console.log(luckyWinner(['pavan','chikkanna','gowda'])) // returns one random name.
console.log(luckyWinner(['pavan','chikkanna','gowda'],2)) // returns two random names
console.log(luckyWinner(['pavan','chikkanna','gowda'],3)) // returns three random names
console.log(luckyWinner(1)) // throws error

Keywords