var procent = 90, yes = 0, no = 0 ; for (var i=0; i<100; i++) { var chance =(Math.random()< procent/100) chance ? yes++ : no++ } alert("yes : " + yes + " no : " + no)