Does PHP use the rand () function to generate token security? Web applications often need to create a token that is difficult to guess, for example, a session token, a CSRF token, or a token used to reset the password in the email in the forgot
This paper compares and analyzes the performance problem of random function Mt_rand () and Rand () in PHP. Share to everyone for your reference. The specific analysis is as follows:
The Mt_rand () and Rand () functions in PHP can randomly generate
Mt_rand () is four times times faster than Rand (), and many of the old libc random number generators have some uncertainties and unknown characteristics and are slow. The rand () function of PHP uses the libc random number generator by default. The
The RAND () Optimization Method for MySQL optimization and the rand Method for mysql Optimization
As we all know, in MySQL, if order by rand () is used directly, the efficiency is very poor because it will be executed multiple times. In fact, this
This paper compares and analyzes the performance problem of random function Mt_rand () and Rand () in PHP. Share to everyone for your reference. The specific analysis is as follows:
in PHP Mt_rand () and Rand () functions are randomly generated a
Comparison between functions rand and mt_rand in PHP. PHP functions rand and mt_randmt_rand () are four times faster than rand (). The old libc random number generator has some uncertain and unknown features and is very slow. PHP rand () functions
Mt_rand () is four times times faster than Rand (), and many of the old libc random number generators have some uncertainties and unknown characteristics and are slow. The rand () function of PHP uses the libc random number generator by default. The
Example 1. Mt_rand () example
The code is as follows
Copy Code
Echo Mt_rand (). "N";Echo Mt_rand (). "N";Echo Mt_rand (5, 15);?>The output of the example above is similar to the following:160471601414786132786
First, get to know the random number function rand () provided by the PHP tutorial. The rand () function of PHP returns a random integer, using the following method
Rand (Min,max)
Optional parameters min and Max can cause rand () to return a
First, to meet the random number function provided by PHP rand (), the rand () function of PHP returns a random integer, using the following method:
Rand (Min,max)
The optional parameter min and Max allows rand () to return a pseudo-random integer
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.