# Man, you're really random!May 26, 2009 8:04 AM   Subscribe

Truly random numbers are hard to come by. Mathematical functions can give you pseudorandom numbers...

If you need the real thing, look to the chaos of reality in a lava lamp, or radioactive decay.

Or, you can build a 7 foot tall, 104 pound, dice-eating monster, capable of generating 1.3 million rolls a day.
posted by bitmage (37 comments total) 12 users marked this as a favorite

/scratches this off of List of Things to Build

(no, seriously)
posted by DU at 8:11 AM on May 26, 2009

posted by Joe Beese at 8:14 AM on May 26, 2009 [1 favorite]

Or, you can build a 7 foot tall, 104 pound, dice-eating monster, capable of generating 1.3 million rolls a day.

Noob question — is this beast going to be less biased than the pseudorandom functions he was using before?

(Off the top of my head, I'd be worried about the way he's processing the images. If it's even slightly more likely to mistake a 6 for a 5, say, than vice versa, then that's gonna bias the results, no?)
posted by nebulawindphone at 8:17 AM on May 26, 2009 [1 favorite]

Noob question — is this beast going to be less biased than the pseudorandom functions he was using before?

Probably not by much. But it's Real Dice, consarnit.
posted by TypographicalError at 8:25 AM on May 26, 2009 [1 favorite]

The reddit comment thread has a few interesting points (in addition to a bunch of snark)
posted by chrisamiller at 8:28 AM on May 26, 2009

There are no random numbers, just permutations of people answering "seven".
posted by Free word order! at 8:29 AM on May 26, 2009 [1 favorite]

I still like the idea of pulling data from a bunch of different sources and applying some math to get a usable number.

Though I have to admit that a giant dice robot thing is pretty cool too.
posted by quin at 8:30 AM on May 26, 2009

While I like the robot - but I have this sense of "Deja-vu" - didn't we recently just discuss randomness?
posted by jkaczor at 8:36 AM on May 26, 2009

There's a couple of patents on automated die reading, though it looks like the Dice-O-Matic probably doesn't infringe either of them. Among other reasons, it uses a different system for identifying the faces than the latter and it isn't concerned with detecting movement, unlike the former. His colored pip counting solution is a much more elegant solution than the ones described in the patents. I really like it.

Given the massive numbers of rolls he his producing, he could do some statistics to verify that the numbers aren't biased in any obvious way. The easiest one is to produce a histogram, which I would actually like to see.
posted by jedicus at 8:37 AM on May 26, 2009

There is also this
posted by a womble is an active kind of sloth at 8:37 AM on May 26, 2009

I saw this on Reddit yesterday. A lot of people there were asking similar questions about why you'd ever want to do this as a source of random numbers. I can only come up with two reasons for its existence, given that there are many established sources for high-quality random numbers (Random.org, hardware TRNGs):

1. The machine isn't superior to more conventional TRNGs used for cryptography, but in fact is probably measurably worse. However, it has the benefit of being totally transparent. The numbers are being used for board games, and by simulating the process that board-game players actually use, complaints about the game mechanics being screwed up by the TRNG are minimized. With other types of TRNG or TRNG+PRNG, the numbers basically come from a black box: the physical process providing the entropy is invisible, and often requires substantial background in quantum mechanics to properly understand. Thus any bad game outcome is easy to blame on the mysterious number generator.

2. The machine is better than the method previously used to generate simulated dice rolls because of some flaw in the dice-roll simulation program. This is tough to imagine given that the guy doing all this seems pretty competent, but it's not that hard to bone up random-number programs if you're not careful. Even if you begin with a truly random source, you can still introduce bias depending on how you convert that to dice rolls or card draws. By actually rolling dice and photographing them, that whole conversion step is eliminated.

I think scenario #1 is probably the case; a transparent and easily-understandable random-number generator is in many cases (cf. lotteries) preferable to one that might be closer to perfectly random but not understandable to most users. Not only is it important to eliminate actual bias, you also need to eliminate the appearance of bias.

An interesting enhancement that several people on Reddit pointed out would be photographing 2 or 3 sides of the dice at once, rather than just one face. If you photographed the top in addition to the 'front,' you'd gain an additional 2 bits of randomness from each roll; you could store this and use it for simulated "coin tosses" or to seed a PRNG for non-dice-based games.
posted by Kadin2048 at 8:37 AM on May 26, 2009 [3 favorites]

look to the chaos of reality

Chaotic systems are not random, just chaotic. They are perfectly describable by mathematical functions, and so are pseudorandom. The thing that makes real, rather than simulated, chaotic systems practically unpredictable (but not random since they are theoretically predictable) is that prediction error stemming from error in baseline values grows as the system evolves, so that for good prediction one needs to know the exact starting conditions, not just to n digits. Since most numbers are irrational, well, there's a problem there.

The radioactive decay thing benefits from Heisenberg and is truly random, in that it is theoretically as well as practically unpredictable.
posted by Mental Wimp at 8:58 AM on May 26, 2009 [1 favorite]

There has got to be an easier way. A cooler way, unlikely.
posted by GuyZero at 8:59 AM on May 26, 2009

If you photographed the top in addition to the 'front,' you'd gain an additional 2 bits of randomness from each r

Would using the information from the other sides be truly random? The pips displayed on the other sides would be dependant on the pip displayed on the top of the die.
posted by fimbulvetr at 9:01 AM on May 26, 2009

Would using the information from the other sides be truly random?
yes, but it would be random between 1 and 4. If there's, say, a face-up then the 6 is face down. The 2,3,4, and 5 are oriented in one of four ways. That is the extra random data that you could extract.
posted by dirtdirt at 9:07 AM on May 26, 2009 [1 favorite]

Geez, did I ever botch that.

Anyway, randomness or not, this thing is BOSS.
posted by dirtdirt at 9:09 AM on May 26, 2009

We had to whip up a random-number generation system to develop thousands of keys to access a multiplayer server. What we ended up doing was a small app that read an audio file bit stream, and then ensured there were no duplicates, no dictionary words accidentally created, and no consecutive strings of more than two identical characters. Whenever we wanted to create a set of keys, we just ran the app and fired up an Internet radio station. Worked like a charm, and took a guy about two hours to write.
posted by Cool Papa Bell at 9:13 AM on May 26, 2009 [1 favorite]

I've been really fascinated with the role that randomness and random numbers have played in divination. The I Ching, for example, is essentially a formula that generates "random" numbers. In the traditionally perfected method of casting and counting of yarrow stalks, the result is never perfectly random, but that's rationalized as a feature and not a bug: the system is slightly biased toward numbers representing robust yang energy. The casting of coins yields straight 50/50 results for every throw, however, which creates a more effectively random result.
posted by hermitosis at 9:14 AM on May 26, 2009

If you need the real thing, look to the chaos of reality in a lava lamp, or radioactive decay. Or, you can build a 7 foot tall, 104 pound, dice-eating monster, capable of generating 1.3 million rolls a day.

or you could just call me. here's a free one: 4
posted by sexyrobot at 9:18 AM on May 26, 2009

or you could just call me. here's a free one: 4

Only 1,299,999 to go. Get crackin'!
posted by graventy at 9:34 AM on May 26, 2009 [1 favorite]

I'd like to see a histogram.
posted by Blazecock Pileon at 9:36 AM on May 26, 2009

Of course this is a silly, impractical idea. It's also beautiful. I love the noise it makes. I love the idea of this machine constantly whirring, spinning, generating pure entropy.
posted by Nelson at 9:53 AM on May 26, 2009

no consecutive strings of more than two identical characters

At which point it's no longer truly random data. I seem to remember that some one-time pads got compromised by this in WWII, because the person drawing the random numbers was discarding duplicates as 'not random enough'. But I can't find a reference online, other than a fictional mention in Cryptonomicon.
posted by bitmage at 10:00 AM on May 26, 2009

ah, the perfect place for the Prime Number Shitting Bear
posted by pantsrobot at 10:01 AM on May 26, 2009 [6 favorites]

At which point it's no longer truly random data. I seem to remember that some one-time pads got compromised by this in WWII...

Indeed. But in our case, we had no ciphertext to hide. Just preventing the creation of a key generator.
posted by Cool Papa Bell at 10:26 AM on May 26, 2009

If you're looking for a more 'natural' kind of randomness ( for creating artificial landscapes/ or art..) there is always Perlin Noise, which was used to generate the background textures in Tron. I've had a lot of fun playing with perlin noise.
posted by localhuman at 10:27 AM on May 26, 2009

That's beautiful.
posted by empath at 10:45 AM on May 26, 2009

"Chaotic systems are not random, just chaotic."

...then why have I been delivering all this blood and souls to sweet prince Arioch?
posted by Smedleyman at 11:10 AM on May 26, 2009 [1 favorite]

If Mr. Pterodactyl is reading this, now is the perfect time for me to launch my career as a random number generator. I KNEW it would come in useful!

I spent a a number of hours over the course of a few afternoons in college making up random in my head and seeing if they were divisible by seven. Since1/7th of them were, then I knew I would be a good random number generator. I have spent the years since trying to convince my husband that this is a solid career with a lot of practical applications for which I am already qualified, to no avail. Thank you for providing me with ammunition in this fight.
posted by Mrs. Pterodactyl at 11:16 AM on May 26, 2009

Indeed. But in our case, we had no ciphertext to hide. Just preventing the creation of a key generator.

If you used a good block cipher (lets say AES) with a random key [from, lets say, hashing a jpg of your cat] to encrypt the numbers 0..N, then discarded the random key, theres no practical way anyone would be able to recover the key (Unless N is crazy, crazy large.)
libtomcrypt has some good PRNG generators, too.
Hell, /dev/random is pretty good on most systems.

Anyway, the radio thing is still a fun way to generate numbers.
posted by blenderfish at 11:19 AM on May 26, 2009

I'd hate to be the poor guy that hs to organize and catalogue all the possible alternate realities that have opened up because of this thing...
posted by joelf at 11:55 AM on May 26, 2009 [2 favorites]

I don't care how random it is... I could watch that machine all day.
posted by not_on_display at 11:56 AM on May 26, 2009 [1 favorite]

And now it's on the front page of /. Oh dear.
posted by bitmage at 12:46 PM on May 26, 2009

More natural randomness: Put a number pad which pseudorandomly generates numbers for each individual key on a spinning board. Bash fist into it at random intervals.
posted by kldickson at 2:29 PM on May 26, 2009

I like this. I particularly like that he was driven to build a ridiculous contraption because people on the internet whined too much.
posted by chairface at 4:47 PM on May 26, 2009 [2 favorites]

I read his article, watched the video, and was impressed. This was the best-executed April Fools joke I've seen in a long, long time. The detail he went to to make it look believable, the technical stuff -- brilliant.

And then I found out that it was real, and my head exploded.

WHY? Why? Again, WHY?

This is all for a games-by-email site with games like Reversi and RISK. It's not a gambling site. It's not regulated by anyone and no money is at stake.

So he built a 7-foot-tall 100-pound noisy dice robot just because some people whined about imperfect randomness? REALLY?

That's still brilliant. But insane.
posted by mmoncur at 8:48 PM on May 26, 2009

Not insane. Awesome. The difference is slight but significant.
posted by JHarris at 7:50 PM on May 27, 2009

« Older Tokyo Camera Style   |   Retro discs like The White Stripes Newer »