i want something like this:
$chance = 40; //40%
if ( run the probability check script ) {
echo "event happened"; //do the event
}
else {
echo "event didn't happened";
}
what is the best solution to achieve something like that?
thanks a lot!
Use rand():
This will return a number between 1 and 100, so that the probability of it being lower or equal to 40 is 40%.