This is an old revision of the document!

# Entropy measurements at key locations

Using a self-made RNG (random number generator) based on avalanche transistor white noise. Analysed for strings, entropy and cumulative deviation against p=0.05 probability.

## Rendlesham forest

Note: After the visit to Rendlesham the RNG results appear skewed and a simple cat /dev/ttyUSB0 would not run continuously. This anomaly later vanished on return to London

# software for plotting

rngplot.py
```#!/usr/bin/python

import Gnuplot, Gnuplot.funcutils, math, sys
g = Gnuplot.Gnuplot(debug=1)

# read in random number file 200 bits at time
# calculate deviation for say each 200*8 bits from say 100 1s
# accumulate deviation to be plotted
# plot also with p=0.05 distribution

def calc_limit_high_005(range):
var = (1.96 / 2) * math.sqrt(range)
limit_high = range/2 + var
return limit_high

def unpack_byte(data):
byte = []
for x in range(8):
byte.append((ord(data)>>x)& 0x01)
return byte

data = []
data.append(unpack_byte(b))
return data

def cum_dev(data):
cum = []
dev = []
cummd=0
for y in range(len(data)/200):
cumd=0
cumz=0
for x in range(200):
a=data[x+(y*200)]
if (a==0):
cumd+=1
else:
cumz+=1
cummd+=cumz-100 # mean is 100
cum.append(cummd)
return cum

file=sys.argv
flatty = [item for sublist in l for item in sublist] # flattened array
cumdevv=cum_dev(flatty)
cumdev=[]
cumd=0
for x in range(len(flatty)/200):
cumd = (calc_limit_high_005(x*200)-x*100) # 200*100=20000
cumdev.append(cumd)

g.title("31st August CSV map 4 cumulative RNG deviation and p=0.05")
g('set term png size 1024,768') # example
g('set output "/root/collect2011/psych/summit2011/logimages/csv4RNG.png"')

g.plot(Gnuplot.Data(cumdev, with='lines'),Gnuplot.Data(cumdevv, with='lines'))```

with thanks to Petr Kazil 