lundi 15 juin 2015

Working of rand() and mt_rand() functions in php

The random number generation functions work based on the pseudorandom number generator (PRNG) algorithm. And according to this algorithm each value in the set from random number is to be chosen will have equal frequency in the output.

I would like to know why the same doesn't stand true when tested for small counts. Say I run a loop to print rand(1,2) ten times, I find an unequal frequency of occurrence for 1 and 2.

Does the point of equal frequency stand only when tested over a very large count value?




Aucun commentaire:

Enregistrer un commentaire