Generate Random Array - Node.js Array

Node.js examples for Array:Random Array

Description

Generate Random Array

Demo Code


function generateRandomArr(n) {
  var randomArr = [];
  for (var i = 0; i < n; i++) {
    randomArr.push(Math.floor(Math.random() * 100));
  }/*from w  ww. j a  v a 2s  .  c  o  m*/
  return randomArr;
};

Related Tutorials