stat.8bit (d82e286489da73321a47e329d98a98817b0438b6) | stat.8bit (1130b656e5fe4c2d1ba299e024d1b40eaeebd380) |
---|---|
1#!/usr/bin/perl 2 3# 4# Perform primitive binning into 8-bit bins (take 8 bits of randomness 5# at a time) and see if the distribution is flat. The output should be 6# checked by eye - are all the numbers roughly the same? 7# 8# Redirect the output from this to a file - and make a cup of coffee while 9# it runs. This program is a CPU Hog! 10# | 1#!/usr/bin/perl 2 3# 4# Perform primitive binning into 8-bit bins (take 8 bits of randomness 5# at a time) and see if the distribution is flat. The output should be 6# checked by eye - are all the numbers roughly the same? 7# 8# Redirect the output from this to a file - and make a cup of coffee while 9# it runs. This program is a CPU Hog! 10# |
11# $Id$ | 11# $FreeBSD$ |
12# 13 14for ($i = 0; $i < (1024*32); $i++) { 15 open(BIN, "/dev/urandom") || die "Cannot open /dev/urandom - $!\n"; 16 $len = sysread(BIN, $a, 256); 17 close(BIN); 18 if ($len > 0) { 19 for ($j = 0; $j < $len; $j++) { 20 $k = unpack("C", substr($a, $j, 1)); 21 $bin[$k]++; 22 } 23 } 24} 25 26for ($i = 0; $i < 256; $i++) { 27 printf("%.2X ", $bin[$i]); 28} 29printf "\n"; | 12# 13 14for ($i = 0; $i < (1024*32); $i++) { 15 open(BIN, "/dev/urandom") || die "Cannot open /dev/urandom - $!\n"; 16 $len = sysread(BIN, $a, 256); 17 close(BIN); 18 if ($len > 0) { 19 for ($j = 0; $j < $len; $j++) { 20 $k = unpack("C", substr($a, $j, 1)); 21 $bin[$k]++; 22 } 23 } 24} 25 26for ($i = 0; $i < 256; $i++) { 27 printf("%.2X ", $bin[$i]); 28} 29printf "\n"; |