Home  >  Article  >  Backend Development  >  Are the random numbers generated by php functions mt_rand, rand, etc. predictable? ?

Are the random numbers generated by php functions mt_rand, rand, etc. predictable? ?

WBOY
WBOYOriginal
2016-07-11 10:21:271463browse

Are the random numbers generated by php functions mt_rand, rand, etc. predictable? ?

Additional question:
Because I recently wanted to build a one-dollar treasure hunt function, I saw on the Internet: For example, the one-dollar treasure hunt plug-in in ecshop uses data related to old lottery and users to calculate luck. number.

But if a function like mb_rand is random enough (that is, almost impossible to predict), then why not use a random function like mb_rand to generate lucky numbers? ? Instead, we have to go through a lot of trouble to retrieve data and perform various calculations? ?

If I use the mb_rand function to generate lucky numbers, is it fair? (I’m afraid that the random numbers generated by this random function will be predicted, and then I meet some advanced players who randomly fiddle with some numbers and predict them. Then That would be unfair)? ?

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn