I have come across a very strange problem. I have tried to find its solution but in vain. My problem is that I want to create a random number between 1-45 and I don\'t want tha
Random selection, by definition, will repeat randomly.
However, you can build an array containing each of your numbers and then shuffle the array, producing a random order of numbers without repetition.
var nums = [], i;
for( i=1; i<=45; i++) nums.push(i);
nums.sort(function(a,b) {return Math.random()-0.5;});
alert(nums.join(","));