Re: [PHP4BETA] cvs: /php4 ChangeLog /php4/ext/standard basic_functions.c basic_functions.h

From: Date: Wed, 06 Oct 1999 13:17:36 +0000
Subject: Re: [PHP4BETA] cvs: /php4 ChangeLog /php4/ext/standard basic_functions.c basic_functions.h
References: 1  Groups: php.version4 
Request: Send a blank email to php-version4+get-5232@lists.php.net to get a copy of this message
Instead of copying zend_hash_sort, let's just rewrite shuffle() to use another algorithm.. Thies C. Arntzen wrote: > chad, please send me your patch... > > right now it's not in PHP4 nor in PHP3, right? > > tc > > > On Mon, 4 Oct 1999, Chad Cunningham wrote: > > > > > Any chance of getting a real shuffle in php4 to avoid the Solaris core dump problem? It's a simple solution, > > all I did with php3 was duplicate the _php3_hash_sort function and instead of calling qsort, did the following. > > > > > > > > > for (k=0; k<i-1; k++) { > > > s = (k+1) + (int)((double)((i-1)-(k+1)+1) * > > > #ifdef HAVE_LRAND48 > > > lrand48() > > > #else > > > #ifdef HAVE_RANDOM > > > random() > > > #else > > > rand() > > > #endif > > > #endif > > > /(PHP_RAND_MAX+1.0)); > > > t = arTmp[k]; > > > arTmp[k] = arTmp[s]; > > > arTmp[s] = t; > > > } > > > > > > Simple and no core dumps :) I also did some bench testing with this vs qsort on redhat6 with php3.0.8, results > > are at http://zeus1.tzo.com/diff.php3. > > > > > > -- > > PHP 4 Beta > > > > > > > Thies C. Arntzen "One Big-Mac, Small Fries and a Coke!" > Digital Collections Phone +49 40 235350 Fax +49 40 23535180 > Hammerbrookstr. 93 20097 Hamburg / Germany > -- End of excerpt from Thies C. Arntzen -Andrei * Use the source, Luke. *

« previous php.version4 (#5232) next »