note 11352 modified in rand by philip

From: Date: Sun, 26 Aug 2001 11:05:59 +0000
Subject: note 11352 modified in rand by philip
Groups: php.notes 
Request: Send a blank email to php-notes+get-17159@lists.php.net to get a copy of this message
Here is the function to generate a random string : function randString ($pass_len = 10) { $allchars = 'abcdefghijklnmopqrstuvwxyzABCDEFGHIJKLNMOPQRSTUVWXYZ0123456789'; $string = ''; mt_srand ((double) microtime() * 1000000); for ($i = 0; $i < $pass_len; $i++) { $string .= $allchars{mt_rand (0,strlen($allchars))}; } return $string; } http://www.php.net/manual/en/rand.php

« previous php.notes (#17159) next »