[Solved] Do not include in random number


So if it is checked then generate a random number? If so this will work: http://jsfiddle.net/5zBg6/3/

var choices = [];
$("#run").click(function(){
    choices = [];
    $( "input:checkbox:checked" ).each(function( i,value ) {
        choices.push($(this).attr('value')); 
    });
    var randomItem = Math.ceil(Math.random()*choices.length)-1;
    alert(choices[randomItem]);
});

Updated to pick a random value of the chosen checked items.

5

solved Do not include in random number