<?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%3Ajsmi233</id>
	<title>SE250:lab-5:jsmi233 - 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%3Ajsmi233"/>
	<link rel="alternate" type="text/html" href="https://wiki.kram.nz/index.php?title=SE250:lab-5:jsmi233&amp;action=history"/>
	<updated>2026-04-30T18:56:15Z</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:jsmi233&amp;diff=6564&amp;oldid=prev</id>
		<title>Mark: 1 revision(s)</title>
		<link rel="alternate" type="text/html" href="https://wiki.kram.nz/index.php?title=SE250:lab-5:jsmi233&amp;diff=6564&amp;oldid=prev"/>
		<updated>2008-11-03T05:19:48Z</updated>

		<summary type="html">&lt;p&gt;1 revision(s)&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;I start today’s lab by attempting to compile the given code. Using the line below to compile, I get a copious amount of errors. Just to confirm this I tried gcc *.c, but the same occurs.&lt;br /&gt;
&lt;br /&gt;
gcc arraylist.c buzhash.c randtest.c lab-5.c -o lab-5.exe &amp;amp;&amp;amp; .\lab-5.exe&lt;br /&gt;
&lt;br /&gt;
It turns out the problem was that I downloaded lab-5.c in html format somehow. Having re-downloaded this file correctly, the code compiles as expected.&lt;br /&gt;
&lt;br /&gt;
It is taking a long time to work out exactly what I am supposed to be doing.&lt;br /&gt;
&lt;br /&gt;
For my choice of numbers I had:&lt;br /&gt;
&lt;br /&gt;
  int sample_size = 1000;&lt;br /&gt;
  &lt;br /&gt;
  int n_keys = 300;&lt;br /&gt;
  &lt;br /&gt;
  int table_size = 3000;&lt;br /&gt;
&lt;br /&gt;
Because I just copied off the guy next to me.&lt;br /&gt;
&lt;br /&gt;
The results of running my program were:&lt;br /&gt;
&lt;br /&gt;
Testing Buzhash low on 1000 samples&lt;br /&gt;
&lt;br /&gt;
Entropy = 7.843786 bits per byte.&lt;br /&gt;
&lt;br /&gt;
Optimum compression would reduce the size 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 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). 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 300/3000: llps = 2, expecting 2.38294&lt;br /&gt;
&lt;br /&gt;
Now I’m going to try and work out what this is supposed to mean. The motivation for desiring very random numbers is obvious. The term “entropy” I assume is being used to refer to the degree of randomness. We are testing the entropy of something. The entropy of the different hash functions. What is the sample size? I still don’t get what the sample size is. Its now 11:09am and I still don’t get what the sample size is. The sample size is the number of times we test the function. Therefore the greater number of samples, the closer we will get to theoretical values.&lt;br /&gt;
&lt;br /&gt;
Hence I chose sample_size = 100000, because with any larger value, the program crashes.&lt;br /&gt;
&lt;br /&gt;
rt_add_buzhash, low entropy source: 7.998297&lt;br /&gt;
&lt;br /&gt;
rt_add_buzhash, typical entropy source: 7.997834&lt;br /&gt;
&lt;br /&gt;
rt_add_buzhashn, low entropy source: 7.998236&lt;br /&gt;
&lt;br /&gt;
rt_add_buzhashn, typical entropy source: 7.998236&lt;br /&gt;
&lt;br /&gt;
rt_add_hash_CRC, low entropy source: 5.574705&lt;br /&gt;
&lt;br /&gt;
rt_add_hash_CRC, typical entropy source: 7.840456&lt;br /&gt;
&lt;br /&gt;
rt_add_Java_Integer, low entropy source: 4.828241&lt;br /&gt;
&lt;br /&gt;
rt_add_Java_Integer, typical entropy source: 4.828241&lt;br /&gt;
&lt;br /&gt;
rt_add_Java_Object, low entropy source: 2.000000&lt;br /&gt;
&lt;br /&gt;
rt_add_Java_Object, typical entropy source: 5.754918&lt;br /&gt;
&lt;br /&gt;
rt_add_Java_String, low entropy source: 7.999587&lt;br /&gt;
&lt;br /&gt;
rt_add_Java_String, typical entropy source: 7.945541&lt;br /&gt;
&lt;br /&gt;
rt_add_base256, low entropy source: 0&lt;br /&gt;
&lt;br /&gt;
rt_add_base256, typical entropy source: 4.022975&lt;br /&gt;
&lt;br /&gt;
rt_add_rand, low entropy source: 7.953082&lt;br /&gt;
&lt;br /&gt;
rt_add_rand, typical entropy source: 7.952724&lt;br /&gt;
&lt;br /&gt;
rt_add_high_rand, low entropy source: 7.998276&lt;br /&gt;
&lt;br /&gt;
rt_add_high_rand, typical entropy source: 7.998075&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
As suggested, the high random function was more random than the rand function.&lt;br /&gt;
&lt;br /&gt;
The functions in order of randomness for the low entropy sources are:&lt;br /&gt;
&lt;br /&gt;
rt_add_Java_String, low entropy source: 7.999587&lt;br /&gt;
&lt;br /&gt;
rt_add_buzhash, low entropy source: 7.998297&lt;br /&gt;
&lt;br /&gt;
rt_add_high_rand, low entropy source: 7.998276&lt;br /&gt;
&lt;br /&gt;
rt_add_buzhashn, low entropy source: 7.998236&lt;br /&gt;
&lt;br /&gt;
rt_add_rand, low entropy source: 7.953082&lt;br /&gt;
&lt;br /&gt;
rt_add_hash_CRC, low entropy source: 5.574705&lt;br /&gt;
&lt;br /&gt;
rt_add_Java_Integer, low entropy source: 4.828241&lt;br /&gt;
&lt;br /&gt;
rt_add_Java_Object, low entropy source: 2.000000&lt;br /&gt;
&lt;br /&gt;
rt_add_base256, low entropy source: 0&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The functions in order of randomness for the typical entropy sources are:&lt;br /&gt;
&lt;br /&gt;
rt_add_buzhashn, typical entropy source: 7.998236&lt;br /&gt;
&lt;br /&gt;
rt_add_high_rand, typical entropy source: 7.998075&lt;br /&gt;
&lt;br /&gt;
rt_add_buzhash, typical entropy source: 7.997834&lt;br /&gt;
&lt;br /&gt;
rt_add_rand, typical entropy source: 7.952724&lt;br /&gt;
&lt;br /&gt;
rt_add_Java_String, typical entropy source: 7.945541&lt;br /&gt;
&lt;br /&gt;
rt_add_hash_CRC, typical entropy source: 7.840456&lt;br /&gt;
&lt;br /&gt;
rt_add_Java_Object, typical entropy source: 5.754918&lt;br /&gt;
&lt;br /&gt;
rt_add_Java_Integer, typical entropy source: 4.828241&lt;br /&gt;
&lt;br /&gt;
rt_add_base256, typical entropy source: 4.022975&lt;br /&gt;
&lt;br /&gt;
 &lt;br /&gt;
&lt;br /&gt;
Expirament two with load factor of 3:&lt;br /&gt;
&lt;br /&gt;
Hash functions with low entropy source in order of coolness:&lt;br /&gt;
&lt;br /&gt;
Java_String_hash low 3000/1000: llps = 5, expecting 9.98866&lt;br /&gt;
&lt;br /&gt;
Buzhash low 3000/1000: llps = 9, expecting 9.98866&lt;br /&gt;
&lt;br /&gt;
hash_CRC low 3000/1000: llps = 30, expecting 9.98866&lt;br /&gt;
&lt;br /&gt;
base256 low 3000/1000: llps = 3000, expecting 9.98866&lt;br /&gt;
&lt;br /&gt;
Java_Object_hash low 3000/1000: llps = 3000, expecting 9.98866&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Hash functions with typical entropy source in order of coolness:&lt;br /&gt;
&lt;br /&gt;
Buzhash typical 3000/1000: llps = 8, expecting 9.98866&lt;br /&gt;
&lt;br /&gt;
Java_String_hash typical 3000/1000: llps = 9, expecting 9.98866&lt;br /&gt;
&lt;br /&gt;
hash_CRC typical 3000/1000: llps = 11, expecting 9.98866&lt;br /&gt;
&lt;br /&gt;
Java_Object_hash typical 3000/1000: llps = 32, expecting 9.98866&lt;br /&gt;
&lt;br /&gt;
base256 typical 3000/1000: llps = 206, expecting 9.98866&lt;/div&gt;</summary>
		<author><name>Mark</name></author>
	</entry>
</feed>