<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Comments on: Implementing Array.shuffle() in Actionscript</title>
	<atom:link href="http://www.daveoncode.com/2009/01/08/implementing-arrayshuffle-in-actionscript/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.daveoncode.com/2009/01/08/implementing-arrayshuffle-in-actionscript/</link>
	<description>Objective C, iOS and more programming stuff</description>
	<lastBuildDate>Fri, 03 Feb 2012 17:32:12 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
	<item>
		<title>By: Alejandro Mena</title>
		<link>http://www.daveoncode.com/2009/01/08/implementing-arrayshuffle-in-actionscript/comment-page-1/#comment-32096</link>
		<dc:creator>Alejandro Mena</dc:creator>
		<pubDate>Thu, 22 Sep 2011 17:37:16 +0000</pubDate>
		<guid isPermaLink="false">http://daveoncode.wordpress.com/?p=209#comment-32096</guid>
		<description>You&#039;re The Man!! Thanks a lot</description>
		<content:encoded><![CDATA[<p>You&#8217;re The Man!! Thanks a lot</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: TheDarkIn1978</title>
		<link>http://www.daveoncode.com/2009/01/08/implementing-arrayshuffle-in-actionscript/comment-page-1/#comment-28717</link>
		<dc:creator>TheDarkIn1978</dc:creator>
		<pubDate>Sun, 21 Aug 2011 01:08:11 +0000</pubDate>
		<guid isPermaLink="false">http://daveoncode.wordpress.com/?p=209#comment-28717</guid>
		<description>posting the above removed the proper code for new Vector object instantiation.</description>
		<content:encoded><![CDATA[<p>posting the above removed the proper code for new Vector object instantiation.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: TheDarkIn1978</title>
		<link>http://www.daveoncode.com/2009/01/08/implementing-arrayshuffle-in-actionscript/comment-page-1/#comment-28715</link>
		<dc:creator>TheDarkIn1978</dc:creator>
		<pubDate>Sun, 21 Aug 2011 01:06:14 +0000</pubDate>
		<guid isPermaLink="false">http://daveoncode.wordpress.com/?p=209#comment-28715</guid>
		<description>private function init():void
{
    var nums:Vector. = new Vector.();
    nums.push(10, 20, 30, 40, 50, 60, 70, 80, 90, 100);
    
    trace(&quot;Ordered: &quot; + nums);
    trace(&quot;Shuffled: &quot; + shuffle(nums));
    trace(&quot;Ordered: &quot; + nums);
}

private function shuffle(vec:Vector.):Vector.
{
    var original:Vector. = vec.slice();
    var result:Vector. = new Vector.();
    
    while (original.length &gt; 0)
    {
        var randomIndex:int = Math.round((original.length - 1) * Math.random());
        result.push(original[randomIndex]);
        original.splice(randomIndex, 1);                
    }
            
    return result;
}</description>
		<content:encoded><![CDATA[<p>private function init():void<br />
{<br />
    var nums:Vector. = new Vector.();<br />
    nums.push(10, 20, 30, 40, 50, 60, 70, 80, 90, 100);</p>
<p>    trace(&#8220;Ordered: &#8221; + nums);<br />
    trace(&#8220;Shuffled: &#8221; + shuffle(nums));<br />
    trace(&#8220;Ordered: &#8221; + nums);<br />
}</p>
<p>private function shuffle(vec:Vector.):Vector.<br />
{<br />
    var original:Vector. = vec.slice();<br />
    var result:Vector. = new Vector.();</p>
<p>    while (original.length &gt; 0)<br />
    {<br />
        var randomIndex:int = Math.round((original.length &#8211; 1) * Math.random());<br />
        result.push(original[randomIndex]);<br />
        original.splice(randomIndex, 1);<br />
    }</p>
<p>    return result;<br />
}</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Philip Hodges</title>
		<link>http://www.daveoncode.com/2009/01/08/implementing-arrayshuffle-in-actionscript/comment-page-1/#comment-27004</link>
		<dc:creator>Philip Hodges</dc:creator>
		<pubDate>Thu, 04 Aug 2011 04:56:29 +0000</pubDate>
		<guid isPermaLink="false">http://daveoncode.wordpress.com/?p=209#comment-27004</guid>
		<description>Cheers! Thanks for sharing.</description>
		<content:encoded><![CDATA[<p>Cheers! Thanks for sharing.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: claire</title>
		<link>http://www.daveoncode.com/2009/01/08/implementing-arrayshuffle-in-actionscript/comment-page-1/#comment-26325</link>
		<dc:creator>claire</dc:creator>
		<pubDate>Thu, 28 Jul 2011 11:34:05 +0000</pubDate>
		<guid isPermaLink="false">http://daveoncode.wordpress.com/?p=209#comment-26325</guid>
		<description>Beautiful! Many thanks Dave!</description>
		<content:encoded><![CDATA[<p>Beautiful! Many thanks Dave!</p>
]]></content:encoded>
	</item>
</channel>
</rss>

