I keep losing this page
I came accross this site and having several BT dongles, decided to give it a try.
It relies on the bccmd out of bluez. Worked well with an el cheapo $2 dongle.
The script below produced a low of 0, and a high of 65535, so presumeably it is filling a 16 bit register with 1s and 0s and bccmd is producing a decimal number. My bccmd is a binary, so guess I will have find the source for it somewhere.
======================================
#!/usr/bin/perl
use strict;
my $bccmd = "/usr/sbin/bccmd rand";
my $high_nr = 0;
my $low_nr = 65568;
foreach (1 .. 100000){
my $cmd_output = `$bccmd`;
#print "$cmd_output\n"; # Random number: 0x8fd7 (36823)
if ($cmd_output =~ m/\((\d+)/)
{$high_nr = $1 if ($1 > $high_nr);$low_nr = $1 if ($1 < $low_nr) };
}
print "$low_nr\t$high_nr\n";
======================================
I generated 1000000 random numbers, took 7 hours and 11 minutes (40 numbers per second) and produced a file 5830542 bytes in size.
Then statistics time, but it seems my grasp of stats is extremely poor as I was clueless as to what I was doing. Never the less I took the million decimal numbers and calculated these facts;
Home generated stats:
mean is 32779
Lowest nr is 0
Highest number is 65535
Stats using the perl module Statistics::Descriptive
Minumun Value 0
Lower quantile 16410 (guess expected would be 65536/4 or 16384 - close?)
Second quantile 32786 (expected 65536/2 or 32768 - also close)
Third quantile 49164
Fourth quantile 65535
Number counted 1000000
Mean of count 32779.339758 (expected 32768)
key = 8191.875, count = 124887 (expected is 1000000/8 or 125000)
key = 16383.75, count = 124690
key = 24575.625, count = 125487
key = 32767.5, count = 124680
key = 40959.375, count = 124870
key = 49151.25, count = 125195
key = 57343.125, count = 124590
key = 65535, count = 125601
No comments:
Post a Comment