Percentage chance of saying something?

Yes, Math.random() is an excellent way to accomplish this. What you want to do is compute a single random number, and then make decisions based on that:

var d = Math.random();
if (d < 0.5)
    // 50% chance of being here
else if (d < 0.7)
    // 20% chance of being here
else
    // 30% chance of being here

That way you don’t miss any possibilities.

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)