Welcome Guest, Not a member yet? Register   Sign In
Is random_string() function generate unique string?
#5

(02-02-2015, 01:43 AM)bblluuss Wrote: Use This code for random string.
public function genRandomString() {
       $length = 20;
       $characters = "O123456789ABCDEFGHIJKLMNPQRSTUVWXYZabcdefghijklmnpqrstuvwxyz~*^";
       $string = '';
       for ($p = 0; $p < $length; $p++) {
           $string .= $characters[rand(0, strlen($characters))];
       }
       return $string;
   }

There's nothing random about it. Read this: http://blog.astrumfutura.com/2013/03/pre...you-think/

Also, the topic is about unique strings, not random ones.
Reply


Messages In This Thread
RE: Is random_string() function generate unique string? - by Narf - 02-02-2015, 01:52 AM



Theme © iAndrew 2016 - Forum software by © MyBB