Re: [PHP-DEV] Re: rand_str

2001-08-05 Thread Daniel Cowgill
- From: "Cynic" <[EMAIL PROTECTED]> To: "Jeroen van Wolffelaar" <[EMAIL PROTECTED]> Cc: "PHP 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 W

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; >> i

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

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.

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,

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; $i<10;

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; $i<10; $i++){ > echo str_rand(),

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. > >>

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 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 a

Re: [PHP-DEV] Re: rand_str

2001-08-05 Thread Cynic
e the following: -- >yes, totally agree. > >but why not put it into PEAR? > >/ d > >- Original Message - >From: "Cynic" <[EMAIL PROTECTED]> >To: "Daniel Andersson" <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]> &g

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

Re: [PHP-DEV] Re: rand_str

2001-08-05 Thread Cynic
y done, yes. but still.. > >maybe something for PEAR instead of the core? > >/ d > > >- Original Message - >From: "Cynic" <[EMAIL PROTECTED]> >To: "Daniel Andersson" <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]> >Sent: Sunday,

Re: [PHP-DEV] Re: rand_str

2001-08-05 Thread Daniel Andersson
el 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 to be able to specify the set of characters... > > At 04

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 PROT