<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0">
  <channel>
    <title>Comments on snippet: 'Randomize an Array'</title>
    <description>Snipplr comments feed</description>
    <link>https://snipplr.com/</link>
    <lastBuildDate>Tue, 14 Apr 2026 16:28:55 +0000</lastBuildDate>
    <item>
      <title>mgeduld said on 19/Jan/2011</title>
      <link>https://snipplr.com/view/47052/randomize-an-array</link>
      <description>&lt;p&gt;This is useful. I would optimize it by caching the length. It's possible that arrays do this anyway, but I think there may be some overhead if you repeatedly call array.length. So...&#13;
&#13;
var len : int = myArray.length;&#13;
&#13;
for (var i:uint = 0; i &lt; len; i++)&#13;
{&#13;
   var rand:uint = int(Math.random() * len);&#13;
   myArray.push( myArray.splice( rand, 1 )[0] );&#13;
}&lt;/p&gt;</description>
      <pubDate>Wed, 19 Jan 2011 08:02:18 UTC</pubDate>
      <guid>https://snipplr.com/view/47052/randomize-an-array</guid>
    </item>
    <item>
      <title>mgeduld said on 19/Jan/2011</title>
      <link>https://snipplr.com/view/47052/randomize-an-array</link>
      <description>&lt;p&gt;This is useful. I would optimize it by caching the length. It's possible that arrays do this anyway, but I think there may be some overhead if you repeatedly call array.length. So...&#13;
&#13;
var len : int = myArray.length;&#13;
&#13;
for (var i:uint = 0; i &lt; len; i++)&#13;
{&#13;
   var rand:uint = int(Math.random() * len);&#13;
   myArray.push( myArray.splice( rand, 1 )[0] );&#13;
}&lt;/p&gt;</description>
      <pubDate>Wed, 19 Jan 2011 08:02:19 UTC</pubDate>
      <guid>https://snipplr.com/view/47052/randomize-an-array</guid>
    </item>
    <item>
      <title>chrisaiv said on 07/Apr/2011</title>
      <link>https://snipplr.com/view/47052/randomize-an-array</link>
      <description>&lt;p&gt;The Casa Library (http://casalib.org) has an incredible set of Array utilities. I use this thing all the time. http://flashspeaksactionscript.com/casa-lib-arrayutil-sorting-searching-arrays/&lt;/p&gt;</description>
      <pubDate>Thu, 07 Apr 2011 03:13:54 UTC</pubDate>
      <guid>https://snipplr.com/view/47052/randomize-an-array</guid>
    </item>
    <item>
      <title>AlyssaPowell said on 10/Jan/2025</title>
      <link>https://snipplr.com/view/47052/randomize-an-array</link>
      <description>&lt;p&gt;great&lt;/p&gt;</description>
      <pubDate>Fri, 10 Jan 2025 16:53:41 UTC</pubDate>
      <guid>https://snipplr.com/view/47052/randomize-an-array</guid>
    </item>
    <item>
      <title>boxeye8766 said on 10/Jan/2025</title>
      <link>https://snipplr.com/view/47052/randomize-an-array</link>
      <description>&lt;p&gt;I personally use them exclusively high-quality elements : you will notice these folks during:	[Orlando Bed Bug Pest Control](https://www.pestcontrolinorlandofl.com/orlando-bed-bug-treatment)&lt;/p&gt;</description>
      <pubDate>Fri, 10 Jan 2025 18:59:35 UTC</pubDate>
      <guid>https://snipplr.com/view/47052/randomize-an-array</guid>
    </item>
  </channel>
</rss>
