Help me please, is it possible to use random function at PHP? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Help me please, is it possible to use random function at PHP?

4th May 2017, 10:39 AM
Muhammad Fauzi
Muhammad Fauzi - avatar
2 Answers
+ 2
If you are seeking a function that generates a random number, then the rand() function will do the job. see more here: http://php.net/manual/en/function.rand.php If you want to randomize an array, then the shuffle() function is what you need. If, on the other hand, you want to randomize a string, then use the str_shuffle() function.
4th May 2017, 12:19 PM
CHMD
CHMD - avatar
0
then when i want to using Fisher Yates Shuffle algorithm so what the best i can use?rand() or shuffle()?
4th May 2017, 1:48 PM
Muhammad Fauzi
Muhammad Fauzi - avatar