PHP Array shuffle, keeping unique
<p>this is my first php script and problem, iv searched hours with no conclusion other than looping a function" too many laterations". but it doesnt solve my problem iv never studied programming or what ever so im hoping that there is an educated person to fill me in on this:</p>

<p>i have an array that contains 120 elements;consists of duplicates eg:</p>

<pre><code>myArray = [0]= item_1, [1] = item _1, [2] = item_2, [3] = item_3 ect..
</code></pre>

<p>Briefly im trying to make a flash php pokermachine but i need these items in the array to be shuffled <strong>BUT</strong> I do not want the duplicates to be next to each other after the shuffle but i need the duplicates to be still in the array</p>

<p>i cant do a loop function to check this because it will change the shuffle too many times wich will effect the odds of the game: below is what i currently have:</p>

<p><a href="http://www.gamezslave.net/test/DynamicSlots.swf" rel="nofollow">http://www.gamezslave.net/test/DynamicSlots.swf</a></p>

<p>you may notice at times it will double up with 2 items in the same reel
Basically i created the virtual reel dynamicly with php.ini file
these values are repeatedly pushed into an array($virtualreel) so the value may appear 10 times in the reel and another value will appear 5 times variating the odds.Than after i take a random slice() from the $virtualreel to display 3 vars from this reel and repeat the loop 4 more times for the other reels, also i only can shuffle once as i want the slice() to  be from the same reels array order</p>

<p>i only shuffle every new spin not running loop functions to shuffle if i double up on a slice(array,3 items).</p>

<p>hope iv explained what im after well enough to give you guys an idea.</p>
