To display 100 buttons randomly, you'd need to first generate a list of unique numbers, then order them randomly. @Felix King has a great suggestion about shuffling, and something like this would work:
function shuffle(array) {
var currentIndex = array.length, temporaryValue, randomIndex;
// While there remain elements to shuffle...
while (0 !== currentIndex) {
// Pick a remaining element...
randomIndex = Math.floor(Math.random() * currentIndex);
currentIndex -= 1;
// And swap it with the current element.
temporaryValue = array[currentIndex];
array[currentIndex] = array[randomIndex];
array[randomIndex] = temporaryValue;
}
return array;
}
var values = [];
$(function () {
var $select = $(".left");
for (i = 1; i <= 100; i++) {
values.push(i);
}
shuffle(values);
for(var i = 0; i < values.length; i++) {
$select.append($('<input type="button"></input>').val(values[i]).html(values[i]));
}
});
You can see it working here: https://jsfiddle.net/igor_9000/hxuy531q/
Hope that helps.