Performance comparison of rand() and mt_rand()
Replies: 2   Views: 1853  Subscribers: 0

Posted by Justin · 21-05-2012 - 06:13

If you and some friends see a pig fly and take a picture of it, and laws of physics tell you it's not possible, then the justification leans towards the factual(and anecdotal) evidence which all participants have seen and recorded, which is that pigs can fly. These results are no different. Though somewhat inconclusive, setting the repeat variable to 30 or higher creates a substantial test case in which a significant difference is notable in the overall ratio. For me, 25 out of 30 samples showed 'rand' to be faster then 'mt_rand'. That's a 5:1 ratio. Clearly a valid assumption can be made with that. Also by setting the sample size to around 500,000 loops or higher seems to render a larger time difference in each sample. As if the aforementioned isn't enough, goes as far as to say that the loser in our test is 4 times faster. THAT shows the obvious editorial error in there documentation unless we are misinterpreting what they call 'faster' as Luc said.­