I need to generate an unique random number for my .each() loop. 
Here is my function for generating the random numbers:
function GenerateRandomNumber(min, max) {
    var random = Math.floor(Math.random() * (max - min + 1)) + min;
    return random;
}
Here is my .each(). 
jQuery.each(P, function (key, value) {
    var rand = GenerateRandomNumber(0, posProduct.length);
    switch (rand) {
        case 0:
            content[2] = P[key].getSquarePro();
            posProduct.splice(posProduct[rand], 1);
            countContent.splice(2, 1);
            alert('1');
            break;
        case 1:
            content[3] = P[key].getSquarePro();
            posProduct.splice(posProduct[rand], 1);
            countContent.splice(3, 1);
            alert('2');
            break;....
    }
    console.log(content, 'content produit')
});
I don't now how to do that. I could have done a for while but I can't fix a maximum (P.length is not fixed ..)
Thanks all!
 
     
    