I want to simulate fight between heros in php. Some heros might have critical, bash, and other spells that have % to activate. So, I thought to make that like this:
if spell has 27% to activate i will put 27 numbers 1 (or any unique thing) on random indexes of array which have 100 members. All others members are any other numbers but not 1. Then i will get 1 random number between 1 - 100 and if on that index on array is nubmer 1 spell is activated. If not, do nothing.
This should work fine, but im interested how much php random function differs from w3 engine random function? Will it be simulated right?
if spell has 27% to activate i will put 27 numbers 1 (or any unique thing) on random indexes of array which have 100 members. All others members are any other numbers but not 1. Then i will get 1 random number between 1 - 100 and if on that index on array is nubmer 1 spell is activated. If not, do nothing.
This should work fine, but im interested how much php random function differs from w3 engine random function? Will it be simulated right?