Apr 17
asides
random numbers & tests
Sam: note that Knuth's discussion of linear congruential is dated; that's *not* what is typically done these days. All: note particularly the notion of "cryptographic randomness".
'true' random number sources
in class exercise :
Everyone type "randomly" 0-9 integers on your keyboard
for awhile into an editor. Upload file here, with a name
like "6812.txt". Don't tell us the file name.
Jim will also upload a few files in the same format
with "pseudo" and "true" random numbers. Then we see
how hard it is to tell which is which.
Related online:
Here's a short python script to generate B/W bitmaps for visual inspection:
# Adapted from http://packages.python.org/pypng/ex.html .
# Uses png.py which can be found at
# http://pypng.googlecode.com/svn/trunk/code/png.py
from random import randint
xSize = 256
ySize = 256
filename = 'bw_python_random_bitmap.png'
data = [[randint(0,1) for i in xrange(xSize)] for j in xrange(ySize)]
import png
png_file = open(filename, 'wb')
writer = png.Writer(xSize, ySize, greyscale=True, bitdepth=1)
writer.write(png_file, data)
png_file.close()