Let's explain what I mean.
Some time ago, when I wrote a program in C #, I made the following mistake:
int Randomize()
{
Random r=new Random();
return r.Next(0,10);
}
in C #, this is an error because, called several times in a row, this function returns the same value. This is because the Random constructor uses a temporary seed, and the time difference between calls was too low (it took me an hour to find this :)).
Now I use rand(...)in php and I need the output to always be different, even if two scripts are running at the same time.
Do I need to do something to get this result, or is it designed to work this way?
source
share