|
Posted by Dominik Susmel on 06/14/05 14:51
Ewoud Dronkert wrote:
> On Mon, 13 Jun 2005 23:58:32 +0200, Dominik Susmel wrote:
>> - seed the rand
>
> Not needed as of PHP4.2.0
true...I don't know what he has
>> - put nubers in array with array_rand
>
> That is not how array_rand() works, please see
> http://php.net/array-rand
duh...he said he has numbers? thus, populate the array and randomize it and
trim it with _rand.. sorry, I thought it was obvious
>> - use array_unique to initialize duplicate entries with 0
>
> Duplicate entries?! Bad algorithm. Also, that is not how
> array_unique() works, please see http://php.net/array-unique
that is how it works - check for yourself.. duplicates are not removed (if
he has any - and shouldn't if he populates from db..)
if you go through the array with it, keys are not removed - they are simply
reinitialized ..look at your link that you've posted by yourself
>
>> - do some magic to 0 numbers in contrast to existing stuff in array
>
> This is really helpful.
yes, indeed it isn't - but that's only if he gets duplicate id's from db (if
I remember correctly - he needs to randomize sequence from db?)...and if he
gets duplicates from this..then magic is what is needed.. some form of
deletion operations
--
--
Dominik Susmel | art director
www.vongestern.com | vonGestern art company . Zagreb, Croatia
[Back to original message]
|