Nodejs Array Random Item Get getRandom(items)

Here you can find the source of getRandom(items)

Method Source Code

function getRandom(items) {
      var item = items[Math.floor(Math.random() * items.length)];
      return item;
   }//from   w w w  .j a va  2 s.c  o  m

Related

  1. getRandomItem(items)
    var getRandomItem = function(items){
      return items[Math.floor(Math.random()*items.length)];