UNPKG

@nasirbaloch/shuffler

Version:

This is the package for any kind of array shuffle and after shuffle it will provide you an random item of that array.

8 lines (7 loc) 321 B
function shuffle(array) { var receivedArray = array; var suffled = receivedArray[Math.floor(Math.random() * receivedArray.length)]; return suffled; //----- thats it, but the main logic behind this, to reduce lines of your frontend code and make it neat and clean. } module.exports = shuffle;