note 11352 added to rand

From: Date: Sat, 17 Feb 2001 01:25:11 +0000
Subject: note 11352 added to rand
Groups: php.notes 
Request: Send a blank email to php-notes+get-11179@lists.php.net to get a copy of this message
Here is the function to generate a rand string. function rand_string ($pass_len = 10) { $allchar = "abcdefghijklnmopqrstuvwxyzABCDEFGHIJKLNMOPQRSTUVWXYZ0123456789" ; $str = "" ; mt_srand ((double) microtime() * 1000000); for ( $i = 0; $i<$pass_len ; $i++ ) $str .= substr( $allchar, mt_rand (0,62), 1 ) ; return $str ; } http://www.php.net/manual/en/function.rand.php

« previous php.notes (#11179) next »