<?xml version="1.0"?>
<rss version="2.0">
	<channel>
		<title>probability and graphs</title>
		<link>http://www.allegro.cc/forums/view/573044</link>
		<description>Allegro.cc Forum Thread</description>
		<webMaster>matthew@allegro.cc (Matthew Leverton)</webMaster>
		<lastBuildDate>Thu, 16 Mar 2006 23:06:38 +0000</lastBuildDate>
	</channel>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>Just a quick question. Say we have a variable which we calculate by adding up two random numbers between 0-100 and then dividing the total by two.</p><p>If we then count the number of times each final number (0-100) comes up after a few thousands iterations and plot it on a graph, would the output be a triangle shape or a bell shaped curve?</p><p><img src="http://www.allegro.cc/forums/smileys/smiley.gif" alt=":)" />
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Richard Phipps)</author>
		<pubDate>Wed, 15 Mar 2006 19:08:19 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>It depend of your random number generator algorythm.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (GullRaDriel)</author>
		<pubDate>Wed, 15 Mar 2006 19:10:07 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>
Well, let&#39;s suppose for the sake of argument that it&#39;s a totally random output.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Richard Phipps)</author>
		<pubDate>Wed, 15 Mar 2006 19:12:06 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>see attachment.</p><p>I took 2x512 random numbers, added them up and took the average as you said. Sorted the resulting numbers and created a chart out of it. If the line would be linear it would be a linear distribution. From what I can rad out of it it really is a bell distribution.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (HoHo)</author>
		<pubDate>Wed, 15 Mar 2006 19:23:18 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>
Why thank you! I didn&#39;t expect someone to go to that much trouble. I just thought some of the math people here already knew the answer from their studies.</p><p>Cheers!<br /><img src="http://www.allegro.cc/forums/smileys/smiley.gif" alt=":)" />
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Richard Phipps)</author>
		<pubDate>Wed, 15 Mar 2006 19:32:06 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>Hm, let&#39;s throw two dice.</p><div class="source-code snippet"><div class="inner"><pre>result     probability
<span class="n">1</span>          <span class="n">0</span>
<span class="n">2</span>          <span class="n">1</span><span class="k3">/</span><span class="n">36</span>
<span class="n">3</span>          <span class="n">2</span><span class="k3">/</span><span class="n">36</span>
<span class="n">4</span>          <span class="n">3</span><span class="k3">/</span><span class="n">36</span>
<span class="n">5</span>          <span class="n">4</span><span class="k3">/</span><span class="n">36</span>
<span class="n">6</span>          <span class="n">5</span><span class="k3">/</span><span class="n">36</span>
<span class="n">7</span>          <span class="n">6</span><span class="k3">/</span><span class="n">36</span>
<span class="n">8</span>          <span class="n">5</span><span class="k3">/</span><span class="n">36</span>
<span class="n">9</span>          <span class="n">4</span><span class="k3">/</span><span class="n">36</span>
<span class="n">10</span>         <span class="n">3</span><span class="k3">/</span><span class="n">36</span>
<span class="n">11</span>         <span class="n">2</span><span class="k3">/</span><span class="n">36</span>
<span class="n">12</span>         <span class="n">1</span><span class="k3">/</span><span class="n">36</span>
</pre></div></div><p>

Now wouldn&#39;t that be a triangle? You need more dice to get the bell. One die gives a line, two dice give a triangle, more dice twist the triangle towards the bell.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Johan Halmén)</author>
		<pubDate>Wed, 15 Mar 2006 19:32:24 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>
Johan: You are not dividing the result by 2 are you?
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Richard Phipps)</author>
		<pubDate>Wed, 15 Mar 2006 19:33:58 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><div class="quote_container"><div class="title">Quote:</div><div class="quote"><p>
would the output be a triangle shape or a bell shaped curve?
</p></div></div><p>
It will approach a bell shaped if the initial distribution is flat.<br />Sketch of proof: near the top of the distribution, the number of ways to create the maximum value remains the same (i.e. 1). The same holds for the minimum value you can generate.<br />However, near the middle of the distribution, there are more ways to generate the result (you can write down the number of permutations that yields the same result, but I can&#39;t be bothered). You can even go further and take the limit of <i>N</i> measurements (instead of 2) and show that the shape of the distribution tends to the normal distribution. You can test this easily with a couple of dice.</p><p>Punchline: if you sum two distributions, the result is a new and different distribution (a sum of flat distributions is no longer flat, nor is the a of normal distributions normal).
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Evert)</author>
		<pubDate>Wed, 15 Mar 2006 20:26:11 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>Why should I divide it? Dividing is just scaling linearly, right? Gosh, now I don&#39;t believe in myself anymore. Got to code that myself. Hate you if I was right. Hate you if I was wrong, too.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Johan Halmén)</author>
		<pubDate>Wed, 15 Mar 2006 22:17:14 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>
Now I&#39;m confused too! <img src="http://www.allegro.cc/forums/smileys/shocked.gif" alt=":o" />
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Richard Phipps)</author>
		<pubDate>Wed, 15 Mar 2006 22:33:22 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>Compile this:
</p><div class="source-code"><div class="toolbar"></div><div class="inner"><table width="100%"><tbody><tr><td class="number">1</td><td><span class="p">#include &lt;allegro.h&gt;</span></td></tr><tr><td class="number">2</td><td>&#160;</td></tr><tr><td class="number">3</td><td><span class="k1">int</span> main<span class="k2">(</span><span class="k2">)</span> <span class="k2">{</span></td></tr><tr><td class="number">4</td><td>  <a href="http://www.allegro.cc/manual/allegro_init" target="_blank"><span class="a">allegro_init</span></a><span class="k2">(</span><span class="k2">)</span><span class="k2">;</span></td></tr><tr><td class="number">5</td><td>  <a href="http://www.allegro.cc/manual/set_color_depth" target="_blank"><span class="a">set_color_depth</span></a><span class="k2">(</span><span class="n">32</span><span class="k2">)</span><span class="k2">;</span></td></tr><tr><td class="number">6</td><td>  <a href="http://www.allegro.cc/manual/set_gfx_mode" target="_blank"><span class="a">set_gfx_mode</span></a><span class="k2">(</span>GFX_AUTODETECT_WINDOWED, <span class="n">640</span>, <span class="n">480</span>, <span class="n">0</span>, <span class="n">0</span><span class="k2">)</span><span class="k2">;</span></td></tr><tr><td class="number">7</td><td>  <a href="http://www.allegro.cc/manual/install_keyboard" target="_blank"><span class="a">install_keyboard</span></a><span class="k2">(</span><span class="k2">)</span><span class="k2">;</span></td></tr><tr><td class="number">8</td><td>&#160;</td></tr><tr><td class="number">9</td><td>  <span class="k1">int</span> num<span class="k2">[</span><span class="n">640</span><span class="k2">]</span><span class="k2">;</span></td></tr><tr><td class="number">10</td><td>  <span class="k1">for</span> <span class="k2">(</span><span class="k1">int</span> i<span class="k3">=</span><span class="n">0</span><span class="k2">;</span> i<span class="k3">&lt;</span><span class="n">640</span><span class="k2">;</span> i<span class="k3">+</span><span class="k3">+</span><span class="k2">)</span> <span class="k2">{</span></td></tr><tr><td class="number">11</td><td>    num<span class="k3">&lt;</span>i&gt; <span class="k3">=</span> <span class="n">0</span><span class="k2">;</span></td></tr><tr><td class="number">12</td><td>  <span class="k2">}</span></td></tr><tr><td class="number">13</td><td>&#160;</td></tr><tr><td class="number">14</td><td>  <a href="http://www.delorie.com/djgpp/doc/libc/libc_739.html" target="_blank">srand</a><span class="k2">(</span><a href="http://www.delorie.com/djgpp/doc/libc/libc_821.html" target="_blank">time</a><span class="k2">(</span><span class="n">0</span><span class="k2">)</span><span class="k2">)</span><span class="k2">;</span></td></tr><tr><td class="number">15</td><td>  <span class="k1">int</span> max <span class="k3">=</span> <span class="n">0</span><span class="k2">;</span></td></tr><tr><td class="number">16</td><td>  <span class="k1">for</span> <span class="k2">(</span><span class="k1">int</span> i<span class="k3">=</span><span class="n">0</span><span class="k2">;</span> i<span class="k3">&lt;</span><span class="n">1000000</span><span class="k2">;</span> i<span class="k3">+</span><span class="k3">+</span><span class="k2">)</span> <span class="k2">{</span></td></tr><tr><td class="number">17</td><td>    <span class="k1">int</span> x <span class="k3">=</span> <a href="http://www.delorie.com/djgpp/doc/libc/libc_637.html" target="_blank">rand</a><span class="k2">(</span><span class="k2">)</span>%<span class="n">640</span><span class="k2">;</span></td></tr><tr><td class="number">18</td><td>    <span class="k1">int</span> y <span class="k3">=</span> <a href="http://www.delorie.com/djgpp/doc/libc/libc_637.html" target="_blank">rand</a><span class="k2">(</span><span class="k2">)</span>%<span class="n">640</span><span class="k2">;</span></td></tr><tr><td class="number">19</td><td>    <span class="k1">int</span> z <span class="k3">=</span> <span class="k2">(</span>x <span class="k3">+</span> y<span class="k2">)</span><span class="k3">/</span><span class="n">2</span><span class="k2">;</span></td></tr><tr><td class="number">20</td><td>    <span class="k3">+</span><span class="k3">+</span>num<span class="k2">[</span>z<span class="k2">]</span><span class="k2">;</span></td></tr><tr><td class="number">21</td><td>    <span class="k1">if</span> <span class="k2">(</span>num<span class="k2">[</span>z<span class="k2">]</span> <span class="k3">&gt;</span> max<span class="k2">)</span> <span class="k2">{</span></td></tr><tr><td class="number">22</td><td>      max <span class="k3">=</span> num<span class="k2">[</span>z<span class="k2">]</span><span class="k2">;</span></td></tr><tr><td class="number">23</td><td>    <span class="k2">}</span></td></tr><tr><td class="number">24</td><td>  <span class="k2">}</span></td></tr><tr><td class="number">25</td><td>&#160;</td></tr><tr><td class="number">26</td><td>  <a href="http://www.allegro.cc/manual/clear_to_color" target="_blank"><span class="a">clear_to_color</span></a><span class="k2">(</span><a href="http://www.allegro.cc/manual/screen" target="_blank"><span class="a">screen</span></a>, <a href="http://www.allegro.cc/manual/makecol" target="_blank"><span class="a">makecol</span></a><span class="k2">(</span><span class="n">212</span>,<span class="n">212</span>,<span class="n">212</span><span class="k2">)</span><span class="k2">)</span><span class="k2">;</span></td></tr><tr><td class="number">27</td><td>  <span class="k1">int</span> col2 <span class="k3">=</span> <a href="http://www.allegro.cc/manual/makecol" target="_blank"><span class="a">makecol</span></a><span class="k2">(</span><span class="n">192</span>,<span class="n">64</span>,<span class="n">64</span><span class="k2">)</span><span class="k2">;</span></td></tr><tr><td class="number">28</td><td>  <span class="k1">for</span> <span class="k2">(</span><span class="k1">int</span> i<span class="k3">=</span><span class="n">0</span><span class="k2">;</span> i<span class="k3">&lt;</span><span class="n">640</span><span class="k2">;</span> i<span class="k3">+</span><span class="k3">+</span><span class="k2">)</span> <span class="k2">{</span></td></tr><tr><td class="number">29</td><td>    <span class="k1">int</span> y1 <span class="k3">=</span> <a href="http://www.allegro.cc/manual/SCREEN_H" target="_blank"><span class="a">SCREEN_H</span></a> <span class="k3">-</span> num<span class="k3">&lt;</span>i&gt;<span class="k3">*</span><a href="http://www.allegro.cc/manual/SCREEN_H" target="_blank"><span class="a">SCREEN_H</span></a><span class="k3">/</span>max<span class="k2">;</span></td></tr><tr><td class="number">30</td><td>    <span class="k1">int</span> y2 <span class="k3">=</span> <a href="http://www.allegro.cc/manual/SCREEN_H" target="_blank"><span class="a">SCREEN_H</span></a><span class="k2">;</span></td></tr><tr><td class="number">31</td><td>    <a href="http://www.allegro.cc/manual/vline" target="_blank"><span class="a">vline</span></a><span class="k2">(</span><a href="http://www.allegro.cc/manual/screen" target="_blank"><span class="a">screen</span></a>, i, y1, y2, col2<span class="k2">)</span><span class="k2">;</span></td></tr><tr><td class="number">32</td><td>  <span class="k2">}</span></td></tr><tr><td class="number">33</td><td>&#160;</td></tr><tr><td class="number">34</td><td>  <a href="http://www.allegro.cc/manual/readkey" target="_blank"><span class="a">readkey</span></a><span class="k2">(</span><span class="k2">)</span><span class="k2">;</span></td></tr><tr><td class="number">35</td><td><span class="k2">}</span></td></tr><tr><td class="number">36</td><td><a href="http://www.allegro.cc/manual/END_OF_MAIN" target="_blank"><span class="a">END_OF_MAIN</span></a><span class="k2">(</span><span class="k2">)</span></td></tr></tbody></table></div></div><p>
It will draw a triangle.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (miran)</author>
		<pubDate>Wed, 15 Mar 2006 23:48:22 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><div class="quote_container"><div class="title">Quote:</div><div class="quote"><p>
Why should I divide it? Dividing is just scaling linearly, right?
</p></div></div><p>
Yes. You should divide it if you want to keep the same normalisation.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Evert)</author>
		<pubDate>Thu, 16 Mar 2006 00:12:59 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>To say it all a different way, let&#39;s throw the dice again.</p><p>To throw a 2 both dice <u>have</u> to fall on one&#39;s, no exceptions.  </p><p>But to get a 7, you could have a &quot;1+6&quot;, &quot;2+5&quot; &quot;3+4&quot; &quot;4+3&quot; &quot;5+2&quot; or &quot;6+1&quot;.</p><p>Well, I suppose listing the result to get 2 would take &quot;1+1&quot; <u>and</u> &quot;1+1&quot; for symmetry.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Arthur Kalliokoski)</author>
		<pubDate>Thu, 16 Mar 2006 01:32:40 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>To clarify what I said in my first post:<br />The sum of <i>N</i> flat distributions tends to a normal distribution as <i>N</i> tends to infinity.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Evert)</author>
		<pubDate>Thu, 16 Mar 2006 03:12:06 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>
</p><div class="quote_container"><div class="title">Quote:</div><div class="quote"><p>
Yes. You should divide it if you want to keep the same normalisation.
</p></div></div><p>

But we&#39;re only interested in the distribution, which shouldn&#39;t change by scaling it.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (X-G)</author>
		<pubDate>Thu, 16 Mar 2006 04:05:27 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>True, but it&#39;s easier to compare the distributions if they&#39;re both normalised.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Evert)</author>
		<pubDate>Thu, 16 Mar 2006 04:07:51 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>
So how do you get a bell shaped curve with probabilites? <img src="http://www.allegro.cc/forums/smileys/huh.gif" alt="???" /></p><p>(None of this is really relevant I guess.. Just curious)
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Richard Phipps)</author>
		<pubDate>Thu, 16 Mar 2006 04:40:37 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p><a href="http://en.wikipedia.org/wiki/Normal_distribution">http://en.wikipedia.org/wiki/Normal_distribution</a>
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Matthew Leverton)</author>
		<pubDate>Thu, 16 Mar 2006 04:50:12 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>
</p><div class="quote_container"><div class="title">Quote:</div><div class="quote"><p>
So how do you get a bell shaped curve with probabilites?
</p></div></div><p>

<a href="http://en.wikipedia.org/wiki/Box-Muller_transform">Box-Muller transform.</a>
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (X-G)</author>
		<pubDate>Thu, 16 Mar 2006 04:56:43 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>
Thanks.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Richard Phipps)</author>
		<pubDate>Thu, 16 Mar 2006 05:01:22 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><div class="quote_container"><div class="title">miran said:</div><div class="quote"><p>
It will draw a triangle.
</p></div></div><p>
Thanks, miran. Now I don&#39;t have to hate anyone.</p><p>[added]
</p><div class="quote_container"><div class="title">Arthur said:</div><div class="quote"><p>
Well, I suppose listing the result to get 2 would take &quot;1+1&quot; <u>and</u> &quot;1+1&quot; for symmetry.
</p></div></div><p>
No. There&#39;s only one 1+1 case.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Johan Halmén)</author>
		<pubDate>Thu, 16 Mar 2006 23:06:38 +0000</pubDate>
	</item>
</rss>
