My table generates 7 random boxes in blue, and 5 other random boxes in yellow, but my problem is that sometimes a boxd "Id" can have 2 or 3 times the same random value, and we see only 5 blue boxes, not 7 as expected. How can I fix it? If the boxe is blue, it can not be a second time, if it is blue, it can not be yellow, etc.
function bluecolor() {
$(".boutton2").click(function() {
for (i = 0; i < 7; i++) {
var rn = Math.floor(Math.random() * 28) + 1;
$("#" + rn).addClass("blue");
}
for (a = 0; a < 5; a++) {
var randome = Math.floor(Math.random() * 28) + 1;
$("#" + randome).addClass("yellow");
}
}
}