Monday, 2 September 2013

How to write a function that might fire, given some probability, say: 0 - 100?

How to write a function that might fire, given some probability, say: 0 -
100?

I need a function with certain probability that it will fire, something like:
function broken_fn ( function () { console.log( Math.random() ); }, 33 ) {
// code...
}
for use in simple online game I'm working on...

No comments:

Post a Comment