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() ?
>
&
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
&
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
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
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
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: