You can do something like ...
var probability = function(n) {
return !!n && Math.random() <= n;
};
Then call him probability(.7). It works because it Math.random()returns a number between and inclusively 0and 1(see Comment).
If you must use 70, just divide it by 100in the body of your function.