简体   繁体   English

mt_rand用相同的数字PHP,这有关系吗?

[英]mt_rand with same numbers PHP, does it matter?

I am coming across having to use mt_rand where both numbers are the same, 我不得不使用两个数字相同的mt_rand,

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 它是在一个while循环中,我没有这样做的错误,但是使用if语句来阻止mt_rand运行会更好吗,或者只是像运行它一样运行它会降低成本效率

 mt_rand(5, 5);

The while loop can have upto 50,000 loops? while循环最多可以有50,000个循环?

Simple answer: test both. 简单回答:测试两者。 If the difference is significant, do it. 如果差异很大,那就去做吧。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM