cgwebprojects
cgwebprojects

Reputation: 3472

mt_rand with same numbers PHP, does it matter?

I am coming across having to use mt_rand where both numbers are the same,

It is in a while loop, I get no errors doing this, but would it be better using an if statement to stop the mt_rand from running, or would it be less cost effective to just run it like

 mt_rand(5, 5);

The while loop can have upto 50,000 loops?

Upvotes: 0

Views: 154

Answers (1)

Evert
Evert

Reputation: 99553

Simple answer: test both. If the difference is significant, do it.

Upvotes: 3

Related Questions