RE: [PHP-WIN] random elements of an array

2002-03-26 Thread Svensson, B.A.T. (HKG)
Can you please explain (elaborate) what you mean? >-Original Message- >From: Nicola Delbono >Sent: Tuesday, March 26, 2002 11:12 AM >To: Svensson, B.A.T. (HKG); [EMAIL PROTECTED] >Subject: RE: [PHP-WIN] random elements of an array > > >why not shuffle() ? > &

RE: [PHP-WIN] random elements of an array

2002-03-26 Thread Nicola Delbono
ECTED] >>Subject: Re: [PHP-WIN] random elements of an array >> > >[...] > >>I have tested this. It works, Even after you refresh the page. Try it! >> >>Nicole >>www.aeontrek.com >> >> >> >>"B.A.T. Svensson" wrote in message &

RE: [PHP-WIN] random elements of an array

2002-03-25 Thread Svensson, B.A.T. (HKG)
Of course the algorithm works... >-Original Message- >From: Nicole Amashta >Sent: Friday, March 22, 2002 4:36 PM >To: [EMAIL PROTECTED] >Subject: Re: [PHP-WIN] random elements of an array > [...] >I have tested this. It works, Even after you refresh the pa

Re: [PHP-WIN] random elements of an array

2002-03-22 Thread Nicole Amashta
Oh, oops ... one line should not be in there ... remove this line from the randomize function: $usedIndexesArray[$i] = $randomIndex; It should not be there. I started to keep track of the indexes used, but i found better way to do it. So remove that line, it does nothing. -Nicole "Nicol

Re: [PHP-WIN] random elements of an array

2002-03-22 Thread Nicole Amashta
And, now, in PHP ... Before randomized ... "; ## print out array before randomized for($i=0; $iAfter randomized ... "; for($i=0; $i 0 && in_array($someArray[$randomIndex],$newArray) ) { $randomIndex = rand(0, $sizeOfArray-1); } $newArray[$i] = $someArray[ $randomIndex ]; $used

RE: [PHP-WIN] random elements of an array

2002-03-22 Thread Svensson, B.A.T. (HKG)
You can completely randomize an array with n elements in n operations, by using the following brute force approach: void ScrambleIntList(int *pnElements, int nLen) { for (nLoop = 0, nLoop-Original Message- >From: Afan Pasalic [mailto:[EMAIL PROTECTED]] >Sent: Thursday, March 21, 2002 9: