

<?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: Choosing Random Numbers Redux</title>
	<atom:link href="http://www.quip.net/blog/2006/flash/choosing-random-numbers-redux/feed" rel="self" type="application/rss+xml" />
	<link>http://www.quip.net/blog/2006/flash/choosing-random-numbers-redux</link>
	<description>Luck is the residue of good design.</description>
	<lastBuildDate>Tue, 20 Mar 2012 15:33:23 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
	<item>
		<title>By: Amy</title>
		<link>http://www.quip.net/blog/2006/flash/choosing-random-numbers-redux#comment-3684</link>
		<dc:creator>Amy</dc:creator>
		<pubDate>Tue, 10 Oct 2006 18:11:53 +0000</pubDate>
		<guid isPermaLink="false">http://www.quip.net/blog/2006/flash/actionscript-20/choosing-random-numbers-redux#comment-3684</guid>
		<description>Cool, thanks to you both. This makes a lot more sense now. :)</description>
		<content:encoded><![CDATA[<p>Cool, thanks to you both. This makes a lot more sense now. <img src='http://www.quip.net/blog/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
]]></content:encoded>
	</item>
	<item>
		<title>By: NSurveyor</title>
		<link>http://www.quip.net/blog/2006/flash/choosing-random-numbers-redux#comment-3664</link>
		<dc:creator>NSurveyor</dc:creator>
		<pubDate>Tue, 10 Oct 2006 02:10:53 +0000</pubDate>
		<guid isPermaLink="false">http://www.quip.net/blog/2006/flash/actionscript-20/choosing-random-numbers-redux#comment-3664</guid>
		<description>Of course it isn&#039;t .4 but .49999999, and not .9 but .9999999999...though the above still illustrates the problem nicely. 

Another way to look at it:
0.0&lt;=x&lt;0.5-&gt;Math.round(x)=0
0.5&lt;=x&lt;1.5-&gt;Math.round(x)=1
1.5&lt;=x&lt;2.5-&gt;Math.round(x)=2
2.5&lt;=x&lt;3.5-&gt;Math.round(x)=3
3.5&lt;=x&lt;4.5-&gt;Math.round(x)=4
....
MAX-0.5&lt;=x&lt;MAX-&gt;Math.round(x)=MAX

From this we see that the range for 0 and MAX is only 0.5, while the between numbers have a range of 1, and thus it is twice as likely to get a middle number than one of the ends.</description>
		<content:encoded><![CDATA[<p>Of course it isn&#8217;t .4 but .49999999, and not .9 but .9999999999&#8230;though the above still illustrates the problem nicely. </p>
<p>Another way to look at it:<br />
0.0&lt;=x&lt;0.5-&gt;Math.round(x)=0<br />
0.5&lt;=x&lt;1.5-&gt;Math.round(x)=1<br />
1.5&lt;=x&lt;2.5-&gt;Math.round(x)=2<br />
2.5&lt;=x&lt;3.5-&gt;Math.round(x)=3<br />
3.5&lt;=x&lt;4.5-&gt;Math.round(x)=4<br />
&#8230;.<br />
MAX-0.5&lt;=x&lt;MAX-&gt;Math.round(x)=MAX</p>
<p>From this we see that the range for 0 and MAX is only 0.5, while the between numbers have a range of 1, and thus it is twice as likely to get a middle number than one of the ends.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: David Stiller</title>
		<link>http://www.quip.net/blog/2006/flash/choosing-random-numbers-redux#comment-3655</link>
		<dc:creator>David Stiller</dc:creator>
		<pubDate>Mon, 09 Oct 2006 19:59:00 +0000</pubDate>
		<guid isPermaLink="false">http://www.quip.net/blog/2006/flash/actionscript-20/choosing-random-numbers-redux#comment-3655</guid>
		<description>Amy,

I&#039;m sure you&#039;re not daft.  ;)  It may be that I confused matters by only going to up three in my diagrams, when my ActionScript code shows a range that goes higher.  Six parts was just arbitrary, otherwise the image would have been wider.

The first diagram is intended to show that the two end numbers &#8212; no matter how long the sequence &#8212; are only chosen half as often as the middle numbers.  In my ActionScript, the return value of &lt;code&gt;Math.random() * 9&lt;/code&gt; might actually be, say, 9.7.  When rounded with &lt;code&gt;Math.round()&lt;/code&gt;, that would become 10.  The return value might be 8.5, which would become 9.  Might be 9.3, which would become 9.  The number 9 has an unfair advantage over 10, in this case.

Make sense?  If not, let me know.</description>
		<content:encoded><![CDATA[<p>Amy,</p>
<p>I&#8217;m sure you&#8217;re not daft.  <img src='http://www.quip.net/blog/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' />   It may be that I confused matters by only going to up three in my diagrams, when my ActionScript code shows a range that goes higher.  Six parts was just arbitrary, otherwise the image would have been wider.</p>
<p>The first diagram is intended to show that the two end numbers &mdash; no matter how long the sequence &mdash; are only chosen half as often as the middle numbers.  In my ActionScript, the return value of <code>Math.random() * 9</code> might actually be, say, 9.7.  When rounded with <code>Math.round()</code>, that would become 10.  The return value might be 8.5, which would become 9.  Might be 9.3, which would become 9.  The number 9 has an unfair advantage over 10, in this case.</p>
<p>Make sense?  If not, let me know.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Amy</title>
		<link>http://www.quip.net/blog/2006/flash/choosing-random-numbers-redux#comment-3626</link>
		<dc:creator>Amy</dc:creator>
		<pubDate>Mon, 09 Oct 2006 11:32:42 +0000</pubDate>
		<guid isPermaLink="false">http://www.quip.net/blog/2006/flash/actionscript-20/choosing-random-numbers-redux#comment-3626</guid>
		<description>Ok, so I sucked at math but I get the rounding bit. What I don&#039;t understand is the purpose of separating it into 6 parts. Why not 0-.4, .5-1.4, 1.5-2.4, 2.5-3 where each, when rounded, equals a whole integer up to 3? Maybe this is your point and I&#039;m daft. ;)

I really appreciate your explaining this topic. It&#039;s something I&#039;ve always shied away from because I couldn&#039;t see the use.</description>
		<content:encoded><![CDATA[<p>Ok, so I sucked at math but I get the rounding bit. What I don&#8217;t understand is the purpose of separating it into 6 parts. Why not 0-.4, .5-1.4, 1.5-2.4, 2.5-3 where each, when rounded, equals a whole integer up to 3? Maybe this is your point and I&#8217;m daft. <img src='http://www.quip.net/blog/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> </p>
<p>I really appreciate your explaining this topic. It&#8217;s something I&#8217;ve always shied away from because I couldn&#8217;t see the use.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: NSurveyor</title>
		<link>http://www.quip.net/blog/2006/flash/choosing-random-numbers-redux#comment-3557</link>
		<dc:creator>NSurveyor</dc:creator>
		<pubDate>Sun, 08 Oct 2006 19:48:25 +0000</pubDate>
		<guid isPermaLink="false">http://www.quip.net/blog/2006/flash/actionscript-20/choosing-random-numbers-redux#comment-3557</guid>
		<description>Glad I could help!</description>
		<content:encoded><![CDATA[<p>Glad I could help!</p>
]]></content:encoded>
	</item>
</channel>
</rss>

