<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	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/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Chris Herring &#187; array</title>
	<atom:link href="http://blog.chrisherring.co.uk/tag/array/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.chrisherring.co.uk</link>
	<description>Interaction, development and everything in between...</description>
	<lastBuildDate>Thu, 10 Mar 2011 09:34:13 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.1</generator>
		<item>
		<title>Shuffle Shuffle Array</title>
		<link>http://blog.chrisherring.co.uk/2009/07/21/shuffle-shuffle-array/</link>
		<comments>http://blog.chrisherring.co.uk/2009/07/21/shuffle-shuffle-array/#comments</comments>
		<pubDate>Tue, 21 Jul 2009 22:04:39 +0000</pubDate>
		<dc:creator>blog.chrisherring.co.uk</dc:creator>
				<category><![CDATA[Snippets]]></category>
		<category><![CDATA[Add new tag]]></category>
		<category><![CDATA[array]]></category>
		<category><![CDATA[as3]]></category>
		<category><![CDATA[shuffle]]></category>

		<guid isPermaLink="false">http://blog.chrisherring.co.uk/?p=415</guid>
		<description><![CDATA[Some projects you find yourself needing to shuffle arrays to randomise the objects within, below is a little static function for Actionscript 3 which will do the above. In order to use the function you need to do the following&#8230; toBeShuffledArray = ArrayShuffle.shuffle(toBeShuffledArray); public class ArrayShuffle() { public static function shuffle(array:Array):Array { var obj:*; var [...]]]></description>
			<content:encoded><![CDATA[<p>Some projects you find yourself needing to shuffle arrays to randomise the objects within, below is a little static function for Actionscript 3 which will do the above. In order to use the function you need to do the following&#8230;</p>
<p><code>toBeShuffledArray = ArrayShuffle.shuffle(toBeShuffledArray);</code></p>
<p><code><br />
public class ArrayShuffle()<br />
{<br />
    public static function shuffle(array:Array):Array<br />
    {<br />
        var obj:*;<br />
        var ran:Number;</p>
<p>        for(var i:Number = 0; i<array.length; i++)<br />
        {<br />
             obj = array[i];<br />
             ran = Math.floor(Math.random() * array.length);<br />
             array[i] = array[ran];<br />
             array[ran] = obj;<br />
        }<br />
        return array;<br />
    }</p>
<p>}<br />
</code></p>
<p><a href="http://blog.chrisherring.co.uk/wp-content/code/ArrayShuffle.as">Source code</a></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.chrisherring.co.uk/2009/07/21/shuffle-shuffle-array/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

