Added random pick module.
This commit is contained in:
9
src/utils/pick-random.js
Normal file
9
src/utils/pick-random.js
Normal file
@@ -0,0 +1,9 @@
|
||||
'use strict';
|
||||
|
||||
const crypto = require('crypto');
|
||||
|
||||
function pickRandom(array) {
|
||||
return array[crypto.randomInt(0, array.length)];
|
||||
}
|
||||
|
||||
module.exports = pickRandom;
|
||||
Reference in New Issue
Block a user