On 10/01/18 18:27, Rick C. Hodgin wrote:
> On Wednesday, January 10, 2018 at 12:15:28 PM UTC-5, Mr. Man-wai Chang wrote:
>> On 11/1/2018 01:07, Robert Wessel wrote:
>>> Tread carefully. The problem is that proper random output is really
>>> hard to verify. Building a device that appears to emit random bits,
>>> and passes any black-box test for randomness, but actually is fully
>>> deterministic, is easy. Building a device that actually produces good
>>> quality true random bits reliably is rather harder. And as I said,
>>> you pretty much can't tell the different from the outside.
>>
>> Is there mathematics to prove that something is 100% random? I supposed
>> most mathematics are NOT random, otherwise, the results would not be
>> reproducable .... :)
>
> I wrote an article on Geek.com years ago about a Tong Fang notebook,
> and it allowed either an Intel Celeron-M or VIA C7-M. The VIA C7-M
> also had a random number generator and I tested it when I was testing
> the notebook.
>
> When the CPU was cold (below about 40C) it was distributed evenly on
> many millions of repeated runs. When it began to heat up it had a
> propensity toward generating values closer to 0 and 255 per byte:
>
>
https://www.geek.com/blurb/vias-c7-m-powered-tongfang-notebook-560893/
>
> The contact I had for VIA Technologies at the time (Van Smith) told
> me that in order be statistically random it shouldn't matter if there
> is a propensity toward specific values, as long as it's truly un-
> predictable.
>
He is right. The mathematics of random numbers is difficult, and I
don't pretend to understand much of it (even though I /do/ have a maths
degree). But basically there are two interesting points about a random
sequence - the distribution of the values, and the non-determinism of
the sequence.
What you were seeing here is that at higher temperatures, the random
number generator no longer has a nice flat distribution - some numbers
turn up more often than others when you look at a large number of
samples. This is something that is easy to check, and it is easy to
think that the numbers are no longer "as random". It is true that they
will have less entropy - you no longer have close to 8 bits of entropy
in your 8-bit numbers. But it is very simple to deal with this - you
can combine multiple samples in a way that linearises the distribution.
A simple method is to use a good hashing function. It does not have to
be a "cryptographically secure" hashing function - even a simple CRC
will do.
To try this, repeat your tests on a hot Via C7 but instead of plotting
the results of each 8-bit generated random number, take 8 samples and
pass them through an 8-bit CRC function - then use /that/ as your random
number for plotting. You'll find it very close to linear.
What is much more important is the non-determinism of the sequence. It
is easy to make pseudo-random number generators that have linear
distributions - it is a lot harder to make one with good entropy in the
sequence. (It is easy to have a fake dice that rolls as many 1's as it
does 6's - it is much harder to make one that will give 11111 roughly
every 7776 sets of 5 rolls, and similarly for any length of sequence.)
That is the key benefit of physical random number generators like the
one in processors like this, which typically measure thermal noise over
a resistor or a diode. That is your source of true entropy - you then
use it as a seed for a pseudo random number generator that gives you a
quick and easy sequence with a good distribution.