|
|
| |
|
|
| |
|
Re: You know you're bored when....
01.12.03, 08:29:44
|
|
|
|
Post #4 (permalink) |
|
|
| |
|
|
Quote:
Originally posted by LarryTheLooter
you have nothing better to do than make **** like this for NO REASON AT ALL.
PHP Code:
function randpass($length){
$chars = '0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz';
$password = "";
for($i=1;$i<=$length;$i++){
$rand = rand(1,strlen($chars));
$password.=$chars{$rand};
}
return $password;
}
I got bored yesterday and thought of making a pass restore function for users. I wanted them spawned randomly, and came up with that little gem. lol (Remember now, I'm a NON-vBoard users :P)
Oh yeah, go check it out.
|
why bother with that functions, which, from the look of it, uses a few extra microseconds than necessary when you can generate a random string based on current time with that function.... hmm.. what's the name of it..... lol. ok, i can't remember the name of the function, but i'm sure there is one. It would be much easier:
> seed the random number generator, based on microsecond
> get string
> md5 string
> use substr to get the desired length. |
______________________________________

|
|
|
|