<?xml version="1.0" encoding="utf-8" ?>
<?xml-stylesheet type="text/xsl" href="RSS_xslt_style.asp" version="1.0" ?>
<rss version="2.0" xmlns:WebWizForums="http://syndication.webwiz.co.uk/rss_namespace/">
 <channel>
  <title>Scirra Forum : Randomize Array</title>
  <link>http://www.scirra.com/forum/</link>
  <description>This is an XML content feed of; Scirra Forum : How do I....? : Randomize Array</description>
  <copyright>Copyright (c) 2006-2011 Web Wiz Forums - All Rights Reserved.</copyright>
  <pubDate>Wed, 19 Jun 2013 06:15:30 +0000</pubDate>
  <lastBuildDate>Fri, 27 Apr 2012 05:53:20 +0000</lastBuildDate>
  <docs>http://blogs.law.harvard.edu/tech/rss</docs>
  <generator>Web Wiz Forums 10.01</generator>
  <ttl>360</ttl>
  <WebWizForums:feedURL>www.scirra.com/forum/RSS_post_feed.asp?TID=51469</WebWizForums:feedURL>
  <image>
   <title>Scirra Forum</title>
   <url>http://www.scirra.com/forum/forum_images/web_wiz_forums.png</url>
   <link>http://www.scirra.com/forum/</link>
  </image>
  <item>
   <title>Randomize Array : @kittiewan - ya, I figured that...</title>
   <link>http://www.scirra.com/forum/randomize-array_topic51469_post324815.html#324815</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="../users/tnewhook">tnewhook</a><br /><strong>Subject:</strong> 51469<br /><strong>Posted:</strong> 27 Apr 2012 at 5:53am<br /><br />@kittiewan - ya, I figured that out about the tries variable. BTW, your Memory Match Tutorial is great! :)]]>
   </description>
   <pubDate>Fri, 27 Apr 2012 05:53:20 +0000</pubDate>
   <guid isPermaLink="true">http://www.scirra.com/forum/randomize-array_topic51469.html</guid>
  </item> 
  <item>
   <title>Randomize Array : Yes, it keeps trying.  The key...</title>
   <link>http://www.scirra.com/forum/randomize-array_topic51469_post324669.html#324669</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="../users/kittiewan">kittiewan</a><br /><strong>Subject:</strong> 51469<br /><strong>Posted:</strong> 26 Apr 2012 at 2:44pm<br /><br />Yes, it keeps trying.  <br /><br />The key is that you only add to the variable i if the random value is not in the array. <br /><br />That way, as long as i is less than the desired number of random numbers in the array, it keeps trying. <br /><br />The variable Tries isn't really necessary to make it work. It is there just to show you how many times it had to loop to get the desired number of unique values. Say you are trying to generate 4 variables (the width of the array). If Tries=10 that means you had to loop 10 times to get 4 unique values.]]>
   </description>
   <pubDate>Thu, 26 Apr 2012 14:44:08 +0000</pubDate>
   <guid isPermaLink="true">http://www.scirra.com/forum/randomize-array_topic51469.html</guid>
  </item> 
  <item>
   <title>Randomize Array : @kittiewan - As I&amp;#039;m looking...</title>
   <link>http://www.scirra.com/forum/randomize-array_topic51469_post324602.html#324602</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="../users/tnewhook">tnewhook</a><br /><strong>Subject:</strong> 51469<br /><strong>Posted:</strong> 26 Apr 2012 at 3:58am<br /><br />@kittiewan - As I'm looking at the code again, I had one question: In step 3, you have a test to see if the array already contains that random number. If the test fails, how does the program know how to handle it? Does it simply retry until it can pass the test. I'm not sure how the statement inside is the loop is handled logically.<br /><br />Thanks again for your help.]]>
   </description>
   <pubDate>Thu, 26 Apr 2012 03:58:29 +0000</pubDate>
   <guid isPermaLink="true">http://www.scirra.com/forum/randomize-array_topic51469.html</guid>
  </item> 
  <item>
   <title>Randomize Array : Thanks guys (and girls)  - I really...</title>
   <link>http://www.scirra.com/forum/randomize-array_topic51469_post324596.html#324596</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="../users/tnewhook">tnewhook</a><br /><strong>Subject:</strong> 51469<br /><strong>Posted:</strong> 26 Apr 2012 at 3:14am<br /><br />Thanks guys (and girls)  - I really appreciate it.<br /><br />@kittiewan - that was just what I needed - much more elegant than my solution. I didn't know I could compare a variable to all elements in an array. <br /><br />@daveryaaziem - I've seen that plugin, but I can't modify the size of the array at runtime. Thanks, tho :)]]>
   </description>
   <pubDate>Thu, 26 Apr 2012 03:14:17 +0000</pubDate>
   <guid isPermaLink="true">http://www.scirra.com/forum/randomize-array_topic51469.html</guid>
  </item> 
  <item>
   <title>Randomize Array : As of C2 Release 87 there are...</title>
   <link>http://www.scirra.com/forum/randomize-array_topic51469_post324590.html#324590</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="../users/kittiewan">kittiewan</a><br /><strong>Subject:</strong> 51469<br /><strong>Posted:</strong> 26 Apr 2012 at 1:21am<br /><br />As of C2 Release 87 there are two features that make this easy:  While loop and a feature to test if a value is in the array.  This isn't your example, but I think it does what you were asking about.  Tries shown are the number of times a random number was generated. If it is bigger than the array width, then there were duplicates among the numbers generated, and so a new random number was generated.<br /><br /><a href="http://dl.dropbox.com/u/57899112/RandomArrayNoDuplicates.capx" target="_blank" rel="nofollow">RandomArrayNoDuplicates.capx</a>]]>
   </description>
   <pubDate>Thu, 26 Apr 2012 01:21:35 +0000</pubDate>
   <guid isPermaLink="true">http://www.scirra.com/forum/randomize-array_topic51469.html</guid>
  </item> 
  <item>
   <title>Randomize Array : Hey tnewhook,You might wanna check...</title>
   <link>http://www.scirra.com/forum/randomize-array_topic51469_post324515.html#324515</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="../users/daveryaaziem">daveryaaziem</a><br /><strong>Subject:</strong> 51469<br /><strong>Posted:</strong> 25 Apr 2012 at 4:24pm<br /><br />Hey tnewhook,<br /><br />You might wanna check out a third party plugin developed by joe7 called random array, I think it will do what you need it to do. I use it on several of my games and it works great. Here's a link:<br /><br />http://www.scirra.com/forum/plugin-randomarray_topic45277.html<br /><br />cheers]]>
   </description>
   <pubDate>Wed, 25 Apr 2012 16:24:47 +0000</pubDate>
   <guid isPermaLink="true">http://www.scirra.com/forum/randomize-array_topic51469.html</guid>
  </item> 
  <item>
   <title>Randomize Array : I&amp;#039;m trying to create an array...</title>
   <link>http://www.scirra.com/forum/randomize-array_topic51469_post324448.html#324448</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="../users/tnewhook">tnewhook</a><br /><strong>Subject:</strong> 51469<br /><strong>Posted:</strong> 25 Apr 2012 at 8:11am<br /><br />I'm trying to create an array with one particular element, and 3 other random elements. There's some checking for duplicates that I'm not doing right, but I haven't been able to debug it. If you refresh the page enough times, some elements will be duplicates. Any suggestions on making this process faster, shorter, better algorithm, etc. would also be appreciated. Thanks in advance, and God bless<br /><br /><a href="http://db.tt/aF4lluvw" target="_blank" rel="nofollow">http://db.tt/aF4lluvw</a>]]>
   </description>
   <pubDate>Wed, 25 Apr 2012 08:11:03 +0000</pubDate>
   <guid isPermaLink="true">http://www.scirra.com/forum/randomize-array_topic51469.html</guid>
  </item> 
 </channel>
</rss>