Re: [PHP-DEV] Re: rand_str

2001-08-05 Thread Daniel Andersson
PROTECTED]; [EMAIL PROTECTED] Sent: Sunday, August 05, 2001 3:41 Subject: Re: [PHP-DEV] Re: rand_str is it that much more useful than md5(microtime()) ? ah-oh, you want to be able to specify the set of characters... At 04:28 8/5/2001, Daniel Andersson wrote the following

Re: [PHP-DEV] Re: rand_str

2001-08-05 Thread Cynic
for PEAR instead of the core? / d - Original Message - From: Cynic [EMAIL PROTECTED] To: Daniel Andersson [EMAIL PROTECTED]; [EMAIL PROTECTED] Sent: Sunday, August 05, 2001 3:41 Subject: Re: [PHP-DEV] Re: rand_str is it that much more useful than md5(microtime()) ? ah-oh, you want

Re: [PHP-DEV] Re: rand_str

2001-08-05 Thread Daniel Andersson
yes, totally agree. but why not put it into PEAR? / d - Original Message - From: Cynic [EMAIL PROTECTED] To: Daniel Andersson [EMAIL PROTECTED]; [EMAIL PROTECTED] Sent: Sunday, August 05, 2001 13:52 Subject: Re: [PHP-DEV] Re: rand_str I think that new functions should be added

Re: [PHP-DEV] Re: rand_str

2001-08-05 Thread Cynic
: -- yes, totally agree. but why not put it into PEAR? / d - Original Message - From: Cynic [EMAIL PROTECTED] To: Daniel Andersson [EMAIL PROTECTED]; [EMAIL PROTECTED] Sent: Sunday, August 05, 2001 13:52 Subject: Re: [PHP-DEV] Re: rand_str I think that new functions

Re: [PHP-DEV] Re: rand_str

2001-08-05 Thread Daniel Andersson
heh.. possibly. ;) forwarded. / d - Original Message - From: Cynic [EMAIL PROTECTED] To: Daniel Andersson [EMAIL PROTECTED]; [EMAIL PROTECTED] Sent: Sunday, August 05, 2001 15:59 Subject: Re: [PHP-DEV] Re: rand_str I'm not against putting it into pear. ask the pear guys what

Re: [PHP-DEV] Re: rand_str

2001-08-05 Thread Jeroen van Wolffelaar
but why not put it into PEAR? PEAR can be useful, but the power of PHP is, that is has so many helpful build-in functions. And with pear, it will always be longer. I think that new functions should be added on basis of usefulness, not the coolness factor. IMNSHO this function isn't very

Re: [PHP-DEV] Re: rand_str

2001-08-05 Thread Cynic
At 17:21 8/5/2001, Jeroen van Wolffelaar wrote the following: -- but why not put it into PEAR? PEAR can be useful, but the power of PHP is, that is has so many helpful build-in functions. And with pear, it will always be longer. I

Re: [PHP-DEV] Re: rand_str

2001-08-05 Thread Jeroen van Wolffelaar
and it is extremely easy to implement in userland: That is not true, So how about this? function str_rand($len=8) { $retval = strtr(md5(microtime()), chr(0x30), chr(0x4F)); return substr($retval,0,$len); } for($i=0; $i10; $i++){ echo str_rand(), \n; } I find

Re: [PHP-DEV] Re: rand_str

2001-08-05 Thread Cynic
At 21:17 8/5/2001, Jeroen van Wolffelaar wrote the following: -- [...] function str_rand($len=8) { $retval = strtr(md5(microtime()), chr(0x30), chr(0x4F)); return substr($retval,0,$len); } for($i=0; $i10; $i++){

Re: [PHP-DEV] Re: rand_str

2001-08-05 Thread Jeroen van Wolffelaar
Hi Jeroen, I think we're not on the same page. :) I consider both versions of str_rand() I posted trivial... Agree. But they are not what rand_str could do. The result has 16 different chars, just because md5 happens to have that much. Implementing something that has NOT that limitation, is

Re: [PHP-DEV] Re: rand_str

2001-08-05 Thread Cynic
At 21:53 8/5/2001, Jeroen van Wolffelaar wrote the following: -- Hi Jeroen, I think we're not on the same page. :) I consider both versions of str_rand() I posted trivial... Agree. But they are not what rand_str could do. The

Re: [PHP-DEV] Re: rand_str

2001-08-05 Thread Jeroen van Wolffelaar
Implementing something that has NOT that limitation, is far less trivial. function str_rand($len = 8, $class = 'a-zA-Z1-9') { static $init = 1; if(1 == $init){ mt_srand((double) microtime() * 100); $init = 0; } $chars = array(); for($i = 0; $i

Re: [PHP-DEV] Re: rand_str

2001-08-05 Thread Cynic
At 22:50 8/5/2001, Jeroen van Wolffelaar wrote the following: -- Implementing something that has NOT that limitation, is far less trivial. function str_rand($len = 8, $class = 'a-zA-Z1-9') { static $init = 1; if(1 ==

Re: [PHP-DEV] Re: rand_str

2001-08-05 Thread Daniel Cowgill
Developers Mailing List [EMAIL PROTECTED] Sent: Sunday, August 05, 2001 5:16 PM Subject: Re: [PHP-DEV] Re: rand_str At 22:50 8/5/2001, Jeroen van Wolffelaar wrote the following: -- Implementing something that has NOT that limitation, is far

[PHP-DEV] Re: rand_str

2001-08-04 Thread Daniel Andersson
sounds useful and cool, me thinks :o) / d [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... Hi, I'm thinking about a new function: [mt_]rand_str Syntax: string [mt_]rand_str(minlen,maxlen[,charlist]); where charlist is in addcslashes (and now also

Re: [PHP-DEV] Re: rand_str

2001-08-04 Thread Cynic
is it that much more useful than md5(microtime()) ? ah-oh, you want to be able to specify the set of characters... At 04:28 8/5/2001, Daniel Andersson wrote the following: -- sounds useful and cool, me thinks :o) / d [EMAIL