Answer the question
In order to leave comments, you need to log in
How are random characters generated in php?
How are random characters generated in php? The question is not which function is responsible for this, but how it works. Back in school, they taught that a computer cannot produce a symbol out of thin air, there are always input values and their handler. So what values does php take as a basis and is it possible to predict them?
Answer the question
In order to leave comments, you need to log in
PRNG
Most often, the generator takes the current date and time (as a single number) as a starting point, after which it performs actions defined by the algorithm with it and produces a finite number of pseudo-random bytes at the output. Finite because all PRNGs are subject to degeneration (at the end it will always give out one number, but this will not happen soon).
As of PHP 7, it is recommended to use random_int .
The generation method differs in different operating systems, in the case of Linux, the getrandom method will be used, which you can read more about here
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question