Well, I think it's pretty cool, but I've always liked physics. Chaotic systems are just like pseudorandom numbers only you don't know the seed. But quantum processes can be genuinly random and fundimentally unpredictable.

Fourmilab, where atom-smashing geeks dwell, has a cute toy in the basement. It generates true random numbers based on radioactive decay, and makes data available to the public.

They have a Java package to programmatically access it, but I wanted to do it in Perl. So I wrote a simple Perl module to access the server. I don't know how useful this is for most folks, but hey, it's cool!

—John
(code follows)

sample program

use strict; use warnings; use HotBits; my $x= new HotBits::; my $bits= $x->request (16); # parameter is bytes to fetch, up to 2048 +. print length($bits)," bytes: "; print unpack("H*", $bits), "\n";

HotBits.pm

=head1 NAME B<HotBits> - download hardware random numbers =head1 AUTHOR John M. Dlugosz - john@dlugosz.com - http://www.dlugosz +.com =head1 DESCRIPTION This module will access "genuine" random numbers via http://www.fourmi +lab.ch/hotbits/. This server at Fourmilab in Switzerland uses radioactive decay to offe +r the truest random number source possible. This module works the same as the site's Java + class for the same purpose: access the CGI program via HTTP. =cut package HotBits; use strict; use warnings; our $VERSION= v1.0; require LWP::UserAgent; use Carp; my $serverURL='http://www.fourmilab.ch/cgi-bin/uncgi/Hotbits'; sub new { my $class= shift; my $URL= shift || $serverURL; # optional argument my $ua = new LWP::UserAgent::; $ua->env_proxy(); my $self= bless { ua => $ua, URL => $URL }, $class; return $self; } sub request { my ($self, $count)= @_; $count ||= 128; my $request = HTTP::Request->new('GET', "$self->{URL}?nbytes=$count&f +mt=bin"); $request->proxy_authorization_basic($ENV{HTTP_proxy_user}, $ENV{HTTP_ +proxy_pass}) if $ENV{HTTP_proxy_user}; my $response = $self->{ua}->request($request); croak "Error from $self->{URL}", if ($response->code() != 200); croak "Unexpected return (not binary) from $self->{URL}" if $response +->headers()->content_type() ne "application/octet-stream"; return $response->content(); } 1; # module loaded OK.

In reply to Genuine Quantum Randomness by John M. Dlugosz

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.