<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en-GB">
	<id>https://wiki.kram.nz/index.php?action=history&amp;feed=atom&amp;title=SE250%3Alab-5%3Atsen009</id>
	<title>SE250:lab-5:tsen009 - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://wiki.kram.nz/index.php?action=history&amp;feed=atom&amp;title=SE250%3Alab-5%3Atsen009"/>
	<link rel="alternate" type="text/html" href="https://wiki.kram.nz/index.php?title=SE250:lab-5:tsen009&amp;action=history"/>
	<updated>2026-04-06T15:52:34Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.45.3</generator>
	<entry>
		<id>https://wiki.kram.nz/index.php?title=SE250:lab-5:tsen009&amp;diff=6875&amp;oldid=prev</id>
		<title>Mark: 9 revision(s)</title>
		<link rel="alternate" type="text/html" href="https://wiki.kram.nz/index.php?title=SE250:lab-5:tsen009&amp;diff=6875&amp;oldid=prev"/>
		<updated>2008-11-03T05:19:57Z</updated>

		<summary type="html">&lt;p&gt;9 revision(s)&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;==Introduction==&lt;br /&gt;
How do hash functions perform in theory and in practice?&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Task==&lt;br /&gt;
The task is to use the given functions to compare the randomness of the given hash functions.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Choosing values===&lt;br /&gt;
The given main function is as follows,&lt;br /&gt;
&lt;br /&gt;
 int main( ) {&lt;br /&gt;
   &amp;#039;&amp;#039;&amp;#039;int sample_size = ???;&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
   &amp;#039;&amp;#039;&amp;#039;int n_keys = ???;&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
   &amp;#039;&amp;#039;&amp;#039;int table_size = ???;&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
 &lt;br /&gt;
   ent_test( &amp;quot;Buzhash low&amp;quot;, low_entropy_src, sample_size, &amp;amp;rt_add_buzhash );&lt;br /&gt;
 &lt;br /&gt;
   printf( &amp;quot;Buzhash low %d/%d: llps = %d, expecting %g\n&amp;quot;,&lt;br /&gt;
           n_keys, table_size,&lt;br /&gt;
 	  llps( n_keys, low_entropy_src, table_size, buzhash ),&lt;br /&gt;
 	  expected_llps( n_keys, table_size ) );&lt;br /&gt;
 &lt;br /&gt;
   return 0;&lt;br /&gt;
 }&lt;br /&gt;
the values of the sample_size, n_keys, table_size need to be alterd...&lt;br /&gt;
&lt;br /&gt;
===Compiling===&lt;br /&gt;
&lt;br /&gt;
The compile command was figured after much confusion and frustration. the compile command used was,&lt;br /&gt;
&lt;br /&gt;
  gcc lab-5.c randtest.c buzhash.c arraylist.c -o bob &amp;amp;&amp;amp; bob.exe&lt;br /&gt;
&lt;br /&gt;
===Initial Test===&lt;br /&gt;
inputs:&lt;br /&gt;
   int sample_size = &amp;#039;&amp;#039;&amp;#039;20&amp;#039;&amp;#039;&amp;#039;;&lt;br /&gt;
   int n_keys = &amp;#039;&amp;#039;&amp;#039;3&amp;#039;&amp;#039;&amp;#039;;&lt;br /&gt;
   int table_size = &amp;#039;&amp;#039;&amp;#039;50&amp;#039;&amp;#039;&amp;#039;;&lt;br /&gt;
Output:&lt;br /&gt;
 Testing Buzhash low on &amp;#039;&amp;#039;&amp;#039;20&amp;#039;&amp;#039;&amp;#039; samples&lt;br /&gt;
 Entropy = &amp;#039;&amp;#039;&amp;#039;4.321928 bits per byte&amp;#039;&amp;#039;&amp;#039;.&lt;br /&gt;
 &lt;br /&gt;
 Optimum compression would reduce the size&lt;br /&gt;
 of this &amp;#039;&amp;#039;&amp;#039;20 byte file by 45 percent&amp;#039;&amp;#039;&amp;#039;.&lt;br /&gt;
 &lt;br /&gt;
 &amp;#039;&amp;#039;&amp;#039;Chi square distribution for 20 samples is 236.00&amp;#039;&amp;#039;&amp;#039;, and &amp;#039;&amp;#039;&amp;#039;randomly&lt;br /&gt;
 would exceed this value 75.00 percent&amp;#039;&amp;#039;&amp;#039; of the times.&lt;br /&gt;
 &lt;br /&gt;
 &amp;#039;&amp;#039;&amp;#039;Arithmetic mean value of data bytes is 117.7500&amp;#039;&amp;#039;&amp;#039; (127.5 = random).&lt;br /&gt;
 Monte Carlo value for Pi is 2.666666667 (&amp;#039;&amp;#039;&amp;#039;error 15.12 percent&amp;#039;&amp;#039;&amp;#039;).&lt;br /&gt;
 &amp;#039;&amp;#039;&amp;#039;Serial correlation coefficient is -0.208584&amp;#039;&amp;#039;&amp;#039; (totally uncorrelated = 0.0).&lt;br /&gt;
 &lt;br /&gt;
 &amp;#039;&amp;#039;&amp;#039;Buzhash low 3/50: llps = 1, expecting 1.03487&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
===Initial Questions===&lt;br /&gt;
&lt;br /&gt;
WHAT ON EARTH DOSE THIS OUTPUT MEAN!!!!!!!!!!! seriously? ZOMG!!!!! (soz for the caps... lol)...&lt;br /&gt;
&lt;br /&gt;
...googles...&lt;br /&gt;
&lt;br /&gt;
===Further Testing===&lt;br /&gt;
well, its obvious i have no idea what im doing, but meh, i thought id pretend that i know what im doing and carry on the experiment with diffrent values, here it goes the big massive result dump...&lt;br /&gt;
&lt;br /&gt;
====Test 1====&lt;br /&gt;
   int sample_size = 1000;&lt;br /&gt;
   int n_keys = 1000;&lt;br /&gt;
   int table_size = 1000;&lt;br /&gt;
&lt;br /&gt;
 Testing Buzhash low on 1000 samples&lt;br /&gt;
 Entropy = 7.843786 bits per byte.&lt;br /&gt;
 &lt;br /&gt;
 Optimum compression would reduce the size&lt;br /&gt;
 of this 1000 byte file by 1 percent.&lt;br /&gt;
 &lt;br /&gt;
 Chi square distribution for 1000 samples is 214.46, and randomly&lt;br /&gt;
 would exceed this value 95.00 percent of the times.&lt;br /&gt;
 &lt;br /&gt;
 Arithmetic mean value of data bytes is 128.0860 (127.5 = random).&lt;br /&gt;
 Monte Carlo value for Pi is 3.132530120 (error 0.29 percent).&lt;br /&gt;
 Serial correlation coefficient is -0.017268 (totally uncorrelated = 0.0).&lt;br /&gt;
 &lt;br /&gt;
 Buzhash low 1000/1000: llps = 6, expecting 5.51384&lt;br /&gt;
&lt;br /&gt;
====Test 2====&lt;br /&gt;
&lt;br /&gt;
   int sample_size = 300;&lt;br /&gt;
   int n_keys = 1;&lt;br /&gt;
   int table_size = 500;&lt;br /&gt;
&lt;br /&gt;
 Testing Buzhash low on 300 samples&lt;br /&gt;
 Entropy = 7.348095 bits per byte.&lt;br /&gt;
 &lt;br /&gt;
 Optimum compression would reduce the size&lt;br /&gt;
 of this 300 byte file by 8 percent.&lt;br /&gt;
 &lt;br /&gt;
 Chi square distribution for 300 samples is 239.31, and randomly&lt;br /&gt;
 would exceed this value 75.00 percent of the times.&lt;br /&gt;
 &lt;br /&gt;
 Arithmetic mean value of data bytes is 131.9200 (127.5 = random).&lt;br /&gt;
 Monte Carlo value for Pi is 3.040000000 (error 3.23 percent).&lt;br /&gt;
 Serial correlation coefficient is -0.083985 (totally uncorrelated = 0.0).&lt;br /&gt;
 &lt;br /&gt;
 Buzhash low 1/500: llps = 1, expecting 0.633119&lt;br /&gt;
&lt;br /&gt;
====Test 3====&lt;br /&gt;
&lt;br /&gt;
   int sample_size = 10000;&lt;br /&gt;
   int n_keys = 200;&lt;br /&gt;
   int table_size = 90;&lt;br /&gt;
&lt;br /&gt;
 Testing Buzhash low on 10000 samples&lt;br /&gt;
 Entropy = 7.985498 bits per byte.&lt;br /&gt;
 &lt;br /&gt;
 Optimum compression would reduce the size&lt;br /&gt;
 of this 10000 byte file by 0 percent.&lt;br /&gt;
 &lt;br /&gt;
 Chi square distribution for 10000 samples is 201.50, and randomly&lt;br /&gt;
 would exceed this value 99.00 percent of the times.&lt;br /&gt;
 &lt;br /&gt;
 Arithmetic mean value of data bytes is 125.8253 (127.5 = random).&lt;br /&gt;
 Monte Carlo value for Pi is 3.181272509 (error 1.26 percent).&lt;br /&gt;
 Serial correlation coefficient is -0.000047 (totally uncorrelated = 0.0).&lt;br /&gt;
 &lt;br /&gt;
 Buzhash low 200/90: llps = 6, expecting 6.64293&lt;br /&gt;
&lt;br /&gt;
====Test 4====&lt;br /&gt;
&lt;br /&gt;
   int sample_size = 999999;&lt;br /&gt;
   int n_keys = 9999;&lt;br /&gt;
   int table_size = 99999;&lt;br /&gt;
&lt;br /&gt;
 Testing Buzhash low on 999999 samples&lt;br /&gt;
 Entropy = 7.999876 bits per byte.&lt;br /&gt;
 &lt;br /&gt;
 Optimum compression would reduce the size&lt;br /&gt;
 of this 1000000 byte file by 0 percent.&lt;br /&gt;
 &lt;br /&gt;
 Chi square distribution for 1000000 samples is 171.27, and randomly&lt;br /&gt;
 would exceed this value 99.99 percent of the times.&lt;br /&gt;
 &lt;br /&gt;
 Arithmetic mean value of data bytes is 127.5198 (127.5 = random).&lt;br /&gt;
 Monte Carlo value for Pi is 3.135468542 (error 0.19 percent).&lt;br /&gt;
 Serial correlation coefficient is -0.000567 (totally uncorrelated = 0.0).&lt;br /&gt;
 &lt;br /&gt;
 Buzhash low 9999/99999: llps = 3, expecting 3.327&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
====Test 5====&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
   int sample_size = 7672;&lt;br /&gt;
   int n_keys = 42;&lt;br /&gt;
   int table_size = 1;&lt;br /&gt;
&lt;br /&gt;
 Testing Buzhash low on 7672 samples&lt;br /&gt;
 Entropy = 7.979032 bits per byte.&lt;br /&gt;
 &lt;br /&gt;
 Optimum compression would reduce the size&lt;br /&gt;
 of this 7672 byte file by 0 percent.&lt;br /&gt;
 &lt;br /&gt;
 Chi square distribution for 7672 samples is 221.42, and randomly&lt;br /&gt;
 would exceed this value 90.00 percent of the times.&lt;br /&gt;
 &lt;br /&gt;
 Arithmetic mean value of data bytes is 125.9483 (127.5 = random).&lt;br /&gt;
 Monte Carlo value for Pi is 3.151799687 (error 0.32 percent).&lt;br /&gt;
 Serial correlation coefficient is 0.000375 (totally uncorrelated = 0.0).&lt;br /&gt;
 &lt;br /&gt;
 Buzhash low 42/1: llps = 42, expecting 41.9999&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Conclusion==&lt;br /&gt;
ZOMG this is annoying /RAGE_QUIT!!!!&lt;/div&gt;</summary>
		<author><name>Mark</name></author>
	</entry>
</feed>