
Really Random Number Generator - aburan28
http://makezine.com/projects/really-really-random-number-generator/
======
dahart
Way cool, saved for later so I can build my own!

The one reaction I have to share is neither here nor there, but there's a
sentence suggesting this is great for games. The two problems you'll have
applying something like this to games are 1- the bandwidth of this RNG is much
slower than your laptop CPU. It'd pair very well with a game running on the
Arduino you build the RNG with though. :) 2- I've done a _lot_ of game
programming, and came to the conclusion that I almost never wanted a random
number stream. They cause repeats way too frequently. Every time I want
"random" behavior in a game nowadays, I generally either pre-generate a set of
behaviors randomly and then shuffle them (guaranteeing you see each behavior
once before any repeats) or use an even uniform sampling in a cycle. It was a
little surprising at first, but I definitely have a better appreciation now
for why game mechanics with some repetition (or maybe "predictability" is a
better word) are more fun than true technically 'random'.

~~~
aaronharnly
I was confused by the "great for games" comment as well, but following the
link shows that the author was thinking of simple hardware "games" such as
this fortune teller consisting of LEDs and fairly simple circuitry. So I think
the clock speed is more than fine for the application he had in mind...

[http://makezine.com/projects/electronics-fun-and-
fundamental...](http://makezine.com/projects/electronics-fun-and-fundamentals-
the-ching-thing/)

~~~
dahart
Ah, in that case, my comment's nearly rude! Sorry, I had software video games
in my head. :P I'm still gonna build it.

------
Animats
The problem with noise-based random number generators is that you have to be
sure your noise source isn't picking up interference. Interference may have
structure, from power line hum to radio carriers to noise from other digital
components.

Here's an alternative which is slightly more paranoid.[1]

[1] [https://www.tindie.com/products/WaywardGeek/infinite-
noise/](https://www.tindie.com/products/WaywardGeek/infinite-noise/)

------
julianpye
Reminds me of the Lavarand, the random number generator by SGI, built out of
lava lamps:

[https://en.wikipedia.org/wiki/Lavarand](https://en.wikipedia.org/wiki/Lavarand)

And its site in all its Web1.0 glory:
[http://web.archive.org/web/20010926221159/http://lavarand.sg...](http://web.archive.org/web/20010926221159/http://lavarand.sgi.com/)

------
jason_s
OK but where's the statistical testing to verify it?

For microelectronics there are better ways for true digital random number
generators, e.g.
[http://citeseerx.ist.psu.edu/viewdoc/download?doi=10.1.1.99....](http://citeseerx.ist.psu.edu/viewdoc/download?doi=10.1.1.99.5781&rep=rep1&type=pdf)

~~~
mathetic
No need. If that sequence is not random, quantum mechanics is in big trouble.

~~~
kaoD
You're not sampling the signal directly on the transistor. There are lots of
places where the randomness could be biased.

------
dagw
Here's my favorite random number generator for use in games :)

[http://gamesbyemail.com/news/diceomatic](http://gamesbyemail.com/news/diceomatic)

~~~
ins0
how about this one :)

[https://github.com/id-
Software/DOOM/blob/77735c3ff0772609e9c...](https://github.com/id-
Software/DOOM/blob/77735c3ff0772609e9c8d29e3ce2ab42ff54d20b/linuxdoom-1.10/m_random.c)

~~~
deelowe
This is how it's really done. :-)

------
mitchtbaum
An RTL-SDR [0] commodity hardware device paired with rtl-entropy [1] seems to
have great potential for filling this need. It has some nice write-ups
[2][3][4] and ongoing development.

0: [http://www.rtl-sdr.com](http://www.rtl-sdr.com)

1: [https://github.com/pwarren/rtl-entropy](https://github.com/pwarren/rtl-
entropy)

2: [http://blog.cros13.net/2014/08/cheap-entropy-using-your-
rtl-...](http://blog.cros13.net/2014/08/cheap-entropy-using-your-rtl-sdr-
as.html)

3: [https://pthree.org/2015/06/16/hardware-rng-through-an-rtl-
sd...](https://pthree.org/2015/06/16/hardware-rng-through-an-rtl-sdr-dongle/)

4: [http://blog.krisk.org/2013/12/high-quality-
entropy.html](http://blog.krisk.org/2013/12/high-quality-entropy.html)

~~~
rwmj
Until the NSA parks outside your house with a transmitter :-) How do you know
it's really random?

~~~
mitchtbaum
I bet if you wave your antenna around, pointing at some bright stars, while
doing a few of your favorite dances, that ought to make that gathered data
stream pretty hard to replicate.. As far as I understand, in terms of
practicality, "randomness" isn't important, only obscurity and/or
unpredictability.

------
memracom
You probably shouldn't trust this unless you can validate the randomness of
the output with tests like Diehard or others
[http://csrc.nist.gov/groups/ST/toolkit/rng/batteries_stats_t...](http://csrc.nist.gov/groups/ST/toolkit/rng/batteries_stats_test.html)

~~~
verandaguy
While it's definitely a good idea to run it through something like Diehard,
it's interesting to note that [this principle has already been the subject of
a lot of
research]([https://www.kernel.org/doc/ols/2014/ols2014-mueller.pdf](https://www.kernel.org/doc/ols/2014/ols2014-mueller.pdf))
(granted, the CPU time jitter uses _time_ noise as an entropy source where the
post uses electrical signal noise, but it's a fairly similar principle all the
same).

------
ademarre
This is informative, and looks like a fun project! But if you're simply
looking for random bits on the Raspberry Pi, don't overlook that it already
comes with a HW RNG built in.

------
detrino
Why would I want to use this over chacha20 seeded properly?

~~~
JoachimS
The Cryptech TRNG uses ChaCha as CSPRNG. ChaCha is seeded using two separate
noise sources of which one is based on the same principle as the one described
in the article.

The output from the entropy sources are mixed using SHA-512 before being used
to seed ChaCha.

The Cryptech TRNG has been and is continiously tested. The current development
will add test functionality to provide online monitoring of the entropy
sources as well as the final output from ChaCha.

There will also be a specific test mode to allow user applications to insert
its own "entropy" and extract generated seed as well as providing test vectors
for ChaCha. In this way it will be possible to verify that the TRNG works
during production, but also verify that the digital chain is in fact working
as specified.

For more see: [http://wiki.cryptech.is/wiki](http://wiki.cryptech.is/wiki)

(Disclaimer: I am the main author of the Cryptech TRNG.)

~~~
detrino
Is gathering 256 bits of entropy a problem that justifies a dedicated piece of
hardware?

------
blt
Optocoupler to step 5v logic down to 3.3v for the raspberry pi is madness.
Just use a voltage divider!

Still, very cool project though!

~~~
hga
Paranoia? Wouldn't things get rather ugly if you accidentally fed a voltage
divider the 18V in that circuit?

~~~
blt
Yes, but the attitude just rubs me the wrong way. If they suggested the
voltage divider, it would have been a good opportunity to instill careful
engineering and testing practices. They could have said something like "this
will fry your GPIO if you accidentally send 18v, so make sure to test the
circuit with a multimeter or scope!" Instead, they suggest throwing an
expensive part at the problem, supporting the attitude that you can't trust
your own engineering. At least they mention that there are other ways to do
it.

I dunno, maybe it's two different, equally valid attitudes. I guess I dislike
it for the same reason I prefer C++ over Java.

~~~
danparsonson
Speaking as a developer, I think the attitude that you can't trust your own
engineering can be a healthy one :-) Defensive coding and all that.

------
randx838
If you want something cool without building yourself,

NeuG is an implementation of a true random number generator, a tiny USB 32-bit
computer based on a free (as in freedom) hardware design.

[http://shop.fsf.org/product/usb/](http://shop.fsf.org/product/usb/)

~~~
Sami_Lehtinen
Here's Alea 2 USB TRNG:
[http://www.araneus.fi/products/alea2/en/](http://www.araneus.fi/products/alea2/en/)

------
abritinthebay
This kind of post is why I love electronics... and why I clearly need to learn
more about it.

------
CamperBob2
Good lord, who taught these guys to draw schematics?

~~~
lstamour
As someone new to schematics, my question is -- how would you improve it?
Genuinely curious...

~~~
CamperBob2
In addition to what mindslight's saying, a schematic should be drawn to make
the signal flow as evident as possible, usually from left to right and top to
bottom. Sometimes this isn't practical or reasonable, such as when
everything's hooked up to an 80-pin IC or something like that, but for a
project this simple it wouldn't have been a problem.

This diagram is a dog's breakfast. The draftsperson apparently thought this
style would make the circuit easier to construct, and perhaps it does, but
their real job was to make the circuit easier to _understand_ , and that
definitely didn't happen.

------
wycx
2 Gbps of true random numbers:

[https://qrng.anu.edu.au/](https://qrng.anu.edu.au/)

------
titfn
the video output of a moving camera mounted on a quadcopter pointing at a
crowd might also be a pretty good source for a random number generator

------
jheriko
this seems like a lot of work compared to an LCG, which is blindingly fast and
more than good enough for game purposes.

~~~
dragontamer
LCG is a pseudo-random number generator.

The electronic design described in the article is a _true_ random number
generator.

~~~
shele
For gaming purposes, a standard pseudo-random number generator is faster, more
reliable and has better statistical properties (!) than this hardware random
number generator. It is also cheaper (cheap as in free software).

~~~
dragontamer
> has better statistical properties

[http://www.cryogenius.com/hardware/isarng/diehard.txt](http://www.cryogenius.com/hardware/isarng/diehard.txt)

The hardware generator passes more diehard tests than the LCG. In any case, a
true-RNG scheme is supposed to feed into a PRNG. True RNGs feed into sources
of entropy, and then you use entropy sources as part of PRNGs to extract more
randomness out of them (if you need speed).

Or not... if you need "security". (Stay slow, so you get tons of entropy)

> a standard pseudo-random number generator is faster

This hardware RNG doesn't require a CPU at all. Its an electronics project
that can feed into anything.

It makes almost no sense to compare a hardware solution against a software
one.

~~~
jheriko
you don't seem to understand the very low requirements for all of the
practical use cases in games. having dedicated hardware for that is going to
require more work for games developers for no detectable benefit.

------
llero
Is it a quantum random number generator ?

