Welcome Guest, Not a member yet? Register   Sign In
Randomly generated string seems to be the same if functions are called at very similar times
#4

[eluser]rogierb[/eluser]
rand() is not a very random funtion. It is better to use mt_rand().

Another idea is to do a shuffle() on $chars to make the order more random
<code>
$chars = "abcdefghijklmnopqrstuvwxyz0123456789";

//randomize characters
$chars = str_split($chars);
shuffle($chars);
$chars = implode('', $chars);

</code>


Messages In This Thread
Randomly generated string seems to be the same if functions are called at very similar times - by El Forum - 09-14-2012, 01:02 AM



Theme © iAndrew 2016 - Forum software by © MyBB