Jump to content

rand() function


squiblo

Recommended Posts

just a general question guys a girls, is the rand() function 100% random or is it based on time?

 

No, it's not possible to generate 100% random numbers using a computer because it's what you call a deterministic device. A computer can't pick a random number off the top of its "head" like a human can. A computer can generate what you call a pseudo-random number, and a program/function/algorithm that does this is called a PRNG (pseudo-random number generator). These rely on some mathematical tricks and a seed value. Giving it the same seed will result in the same pseudo-random number. The seed is often based on the computer's internal clock.

Link to comment
https://forums.phpfreaks.com/topic/178533-rand-function/#findComment-941864
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.