rand() :
Slow process, max allowed length smaller than mt_rand(), may has dubious or unknown characteristics, can get max limit by getrandmax(), using old technique.
Syntax: int rand(min,max);
Example: echo rand(0,500); // return value between 0 to 500 (including 0 and 500)
mt_rand():
Four times faster than rand(), had large max length, return known characteristics, can get max limit by mt_getrandmax().
Syntax: int mt_rand(min,max);
Example: echo rand(100,99999); // return value between 100 to 99999
Conclusion:
In my point of view mt_rand() is better than rand() in any cases.
Slow process, max allowed length smaller than mt_rand(), may has dubious or unknown characteristics, can get max limit by getrandmax(), using old technique.
Syntax: int rand(min,max);
Example: echo rand(0,500); // return value between 0 to 500 (including 0 and 500)
mt_rand():
Four times faster than rand(), had large max length, return known characteristics, can get max limit by mt_getrandmax().
Syntax: int mt_rand(min,max);
Example: echo rand(100,99999); // return value between 100 to 99999
Conclusion:
In my point of view mt_rand() is better than rand() in any cases.
No comments:
Post a Comment