mercredi 1 décembre 2021

php random 2 Million times gives not 50/50

can you explain why I did not get exact 50% above and 50% bellow when I launch this random 4 millions times

 $a = random_int(1, 100);
    if ($a<=50) {
        $_SESSION['ainf']++;
    } else {
         $_SESSION['asup']++;
    }

I get this result above : 2059162 = 49.9675%

bellow 2061838 = 50.0325%

this is strange no ? with 4M times, I expect to fit on 50/50 ? is that normal ? thanks




Aucun commentaire:

Enregistrer un commentaire