Is this how PHP implemented random number generating?
Say I want to calculate a yes or a no. Everytime I have a certain probability percentage (say: 0,05% for this example).
I do:
$possibilities = 100 / $probabilityPercentage; //$possibilities = 2000
$yes = rand(1,$possibilities);
$yesCheck = $possiblities; //OPTION 1
$yesCheck = rand(1,$possibilities); //OPTION 2
($yesCheck == $yes) ? return true : return false;
Does it give the same results with either option?
Let the data speak for itself.
Code
Test run
Given the above results I’d say that for all practical purposes, both options are equivalent, giving the expected 1/1000 result on both cases.