random

[littlebird] posted a tutorial on making electronic dice. He’s using an ATmega328 for the numbers work, and a mercury switch to activate it all. A nice blue enclosure to match the blue LEDs he’s using for the number display wraps it up nicely. Of course, someone had to mention that this was an amazing amount of over kill and it could just be done with a 555 timer like they used to do “back in the day”. [littlebird] responded with another tutorial to prove that he hadn’t forgotten how to work with the basics. He goes on to point out, now that we see both in action, that he can expand his microcontroller based one quickly with a few lines of code, where every new feature added to the 555 timer version would require additional components.

True randomness can be hard to come by in the digital world. [Andy Green] is making it easier to get true entropy by using this random USB dongle. The Whirlygig uses a CPDL to gather data from a set of of oscillators. The oscillators have a constantly fluctuating frequency due to temperature changes; if they run faster they generate more heat which in turn slows them down. This, along with the variable latency associated with polling a USB device, gives great depth of randomness. The device is detected and mounted under ‘/dev/hw_random’ and can then be fed into ‘/dev/random’ using the rng-tools package. [Andy’s] done a lot of testing, both on the hardware, and on the quality of randomness. We didn’t see an option to order this but he’s got hardware and firmware repositories so that you can throw one together yourself.

The USB Hourglass combines a sand timer with a rotating mechanism and an optical beam through the center of the timer to observe the falling sand. The amount of light reaching a detector is digitized at frequent intervals and processed by a microcontroller to determine when to rotate the hourglass. The digitized light levels are also sent by USB to a host PC where they can be used as a source of random entropy. Power is supplied over the USB cable.

With the USB Hourglass, the user can look at the sand falling through the center of the hourglass and monitor the randomness in the USB output data. And one can read the code line-by-line, compile it, and upload it to the microcontroller using only open-source and widely supported tools.

[MS3FGX] has done an interesting study about using Bluetooth adapters as a source for Pseudorandom Number Generation (PRNG). As it turns out, the Bluez package has a function that calls a remote Bluetooth adapter to return a random number. He picked up 10 compatible adapters for about $30 from DealExtreme and set about assembling some numbers to see how this compares to an OS-based PRNG.

Because millions of samples are needed for an accurate comparison, time became a problem. The adapters are a little bit slow responding to a request, sending just 4800 numbers in the first 30-second test. This can be overcome with multiple adapters being accessed by multiple computers for hours at a time. What can this be used for? Your guess is as good as ours, but [MS3FGX] has done a great job of writing up his tests. He’s also made a set of 20.7 million randomly generated values available if you want to generate your own statistical analysis.

[Scott] runs gamesbyemail.com. One of his biggest hurdles was producing real random numbers for the games. He had tried various methods like math.random and random.org, but kept getting complaints about the quality of the random numbers. His solution was to build an automatic dice roller. His initial attempts were made from Legos and were never quite reliable enough to be put into the system. The Dice-O-Matic however has proven to be a random number generating monster. It is 7 feet tall and capable of 1.3 million dice rolls per day. Wow.

[aballen] wanted to light the jack-o’-lantern this year with something that didn’t actually require fire. After searching for a project that was cheap and yielded decent results, he ended up just making his own. This project utilizes an ATtiny13 and two LEDs, red and orange. The overall build is quick and simple with some very basic code for the flickering. If you really want it more enclosed, there is this similar project using a cheap electric candle. Of course, not everyone has the time or desire to make one that is this realistic. You could always just go the easy way, no microcontroller required.

What is it about pseudo random flashing LEDs that make us go gaga? We don’t know, but there’s definitely something there. [seligtobiason] has this obsession too. After seeing several more complicated projects, he created this elegant, simple, and cheap piece of art. The entire thing is pretty much just some flashing LEDs, some resistors, and a power supply. It really isn’t anything groundbreaking, but the effort and cost involved are tiny compared to some other similar projects. sure, it doesn’t synchronize over time based on input like the firefly project. But for a quick cheap project, the results are quite nice.