Hi
I think that I seem to have successfully created and tested a very simple script which when run on a Windows VPS, serves as a building block for a True Random Number Generator. I am therefore wondering to myself, if it is this easy then what is the point of Pseudo Random Number Generators?
Here is the script.
#! /usr/bin/perl
use Time::HiRes qw(gettimeofday);
($seconds, $microseconds[0]) = gettimeofday;
for ($count = 1; $count <= 1000000; $count++)
{
}
($seconds, $microseconds[1]) = gettimeofday;
$difference = $microseconds[1] - $microseconds[0];
print "Content-type:text/html\n\n";
print "$difference";
Typical outputs:
46980
-953586
47168
67242
59319
As you can see from the above outputs, this script seems to work very well.
Would this script work as well on a dedicated server with a very fast CPU? Are timings on VPS servers particularly volatile? Would this script work as well on all Windows systems?
If I am creating an application which is critically dependent on a good quality TRNG, can anyone see any reason why it might be a mistake to depend on this script for the purpose?
Thank you very much.
Kind regards
Tim
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: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.