Get random array with out duplicate - Javascript

Get random array

Snippet Code


  
Rate this page :
  [ 0 votes]

To give first input is minimum value and second input is maximum value.The output is randomize array.

function getRandomArray(min,max){ var A= []; while(max>= min) A.push(max--) A.sort(function(){return .5- Math.random()}); return A; } var test = getRandomArray(1,9); alert(test);

Tags


Ask Questions

Ask Question