No Die? No Problem: RealDice.org Has You Covered

Have you ever been out and about and needed to make a check against INT, WIS or CON but not had a die handy? Sure, you could use an app on your phone, but who knows what pseudorandom nonsense that’s getting up to. [Lazy Hovercraft] has got the solution with his new site RealDice.org, which, well, rolls real dice.

Well, one die, anyway. The webpage presents a button to roll a single twenty-sided die, or “Dee-Twenty” as the cool kids are calling it these days. The rolling is provided by a unit purchased from Amazon that spins the die inside a plastic bubble, similar to this unit we covered back in 2020.  (Alas for fans of the venerable game Trouble, it does not pop.) The die spinner’s button has been replaced by a relay, which is triggered from the server whenever a user hits the “roll” button.

You currently have to look at the camera feed with your own eyes to learn what number was rolled, but [Lazy Hovercraft] assures us that titanic effort will be automated once he trains up the CVE database. To that end you are encouraged to help build the dataset by punching in what number is shown on the die.

This is a fun little hack to get some physical randomness, and would be great for the sort of chatroom tabletop gaming that’s so common these days. It may also become the new way we select the What’s That Sound? winners on the Hackaday Podcast.

Before sitting down for a game session, you might want to make sure you’re all using fair dice. No matter how fair the dice, its hard to beat quantum phenomena for random noise.

Quantum Random Number Generator Squirts Out Numbers Via MQTT

Sometimes you need random numbers — and properly random ones, at that. Hackaday Alum [Sean Boyce] whipped up a rig that serves up just that, tasty random bytes delivered fresh over MQTT.

[Sean] tells us he’s been “designing various quantum TRNGs for nearly 15 years as part of an elaborate practical joke” without further explanation. We won’t query as to why, and just examine the project itself. The main source of randomness — entropy, if you will — is a pair of transistors hooked up to create a bunch of avalanche noise that is apparently truly random, much like the zener diode method.

In any case, the noise from the transistors is then passed through a bunch of hex inverters and other supporting parts to shape the noise into a nicely random square wave. This is sampled by an ATtiny261A acting as a Von Neumann extractor, which converts the wave into individual bits of lovely random entropy. These are read by a Pi Pico W, which then assembles random bytes and pushes them out over MQTT.

Did that sound like a lot? If you’re not in the habit of building random number generators, it probably did. Nevertheless, we’ve heard from [Sean] on this topic before. Feel free to share your theories on the best random number generator designs below, or send your best builds straight to the tipsline. Randomly, of course!

That Coin Toss Isn’t Actually 50/50

A coin flip is considered by many to be the perfect 50/50 random event, even though — being an event subject to Newtonian physics — the results are in fact anything but random. But that’s okay, because what we really want when we flip a coin is an unpredictable but fair outcome. But what if that’s not actually what happens?

There’s new research claiming that coin tosses demonstrate a slight but measurable bias toward landing on the same side they started. At least, this is true of coin flips done in a particular (but common) way. Coins flipped with the thumb and caught in the hand land with the same side facing up 50.8 percent of the time.

The new research builds on earlier work proposing that because of human anatomy, when a human flips a coin with their thumb, the motion introduces a slight off-axis tilt that biases the results. Some people do it less (biasing the results less) and some do it more, but while the impact is small it is measurable. As long as the coin is caught in the hand, anyway. Allowing the coin to fall on surfaces introduces outside variables.

Therefore, one can gain a slight advantage in coin flips by looking at which side is facing up, and calling that same side. Remember that the flipping method used must be that of flipping the coin with the thumb, and catching it with the hand. The type of coin does not matter.

Does this mean a coin flip isn’t fair? Not really. Just allow the coin to fall on a surface instead of catching it in the hand, or simply conceal which side is “up” when the coin is called. It’s one more thing that invites us all to ask just how random is random, anyway?

Math Reveals How Many Shuffles Randomizes A Deck

Math — and some clever simulations — have revealed how many shuffles are required to randomize a deck of 52 cards, but there’s a bit more to it than that. There are different shuffling methods, and dealing methods can matter, too. [Jason Fulman] and [Persi Diaconis] are behind the research that will be detailed in an upcoming book, The Mathematics of Shuffling Cards, but the main points are easy to cover.

A riffle shuffle (pictured above) requires seven shuffles to randomize a 52-card deck. Laying cards face-down on a table and mixing them by pushing them around (a technique researchers dubbed “smooshing”) requires 30 to 60 seconds to randomize the cards. An overhand shuffle — taking sections from a deck and moving them to new positions — is a staggeringly poor method of randomizing, requiring some 10,000-11,000 iterations.

The method of dealing cards can matter as well. Back-and-forth dealing (alternating directions while dealing, such as pattern A, B, C, C, B, A) yields improved randomness compared to the more common cyclic dealing (dealing to positions in a circular repeating pattern A, B, C, A, B, C). It’s interesting to see different dealing methods shown to have an effect on randomness.

This brings up a good point: there is not really any such a thing as “more” random. A deck of cards is either randomized, or it isn’t. If even two cards have remained in the same relative positions (next to one another, for example) after shuffling, then a deck has not yet been randomized. Similarly, if seven proper riffle shuffles are sufficient to randomize a 52-card deck, there is not really any point in doing eight or nine (or more) because there isn’t any such thing as “more” random.

You can watch these different methods demonstrated in the video embedded just under the page break. Now we know there’s no need for a complicated Rube Goldberg-style shuffling solution just to randomize a deck of cards (well, no mathematical reason for one, anyway.)

Continue reading “Math Reveals How Many Shuffles Randomizes A Deck”

Automated musical instrument with LED array

ESP32 Is The Brains Behind This Art Installation

The ESP32 has enabled an uncountable number of small electronics projects and even some commercial products, thanks to its small size, low price point, and wireless capabilities. Plenty of remote sensors, lighting setups, and even home automation projects now run on this small faithful chip. But being relegated to an electronics enclosure controlling a small electrical setup isn’t all that these tiny chips can do as [Eirik Brandal] shows us with this unique piece of audio and visual art.

The project is essentially a small, automated synthesizer that has a series of arrays programmed into it that correspond to various musical scales. Any of these can be selected for the instrument to play through. The notes of the scale are shuffled through with some random variations, allowing for a completely automated musical instrument. The musical generation is entirely analog as well, created by some oscillators, amplifiers, and other filtering and effects. The ESP32 also controls a lighting sculpture that illuminates a series of LEDs as the music plays.

The art installation itself creates quite haunting, mesmerizing tunes that are illustrated in the video linked after the break. While it’s not quite to the realm of artificial intelligence since it uses pre-programmed patterns with some randomness mixed in, it does give us hints of some other projects that have used AI in order to compose new music.

Continue reading “ESP32 Is The Brains Behind This Art Installation”

Hamster Trades Crypto Better Than You

The inner machinations of the mind of cryptocurrency markets are an enigma. Even traditional stock markets often seem to behave at random, to the point that several economists seriously suggest that various non-human animals might outperform one market or another just by random chance alone. The classic example is a monkey picking stocks at random, but in the modern world the hamster [Mr Goxx] actively trades crypto from inside his hamster cage.

[Mr Goxx]’s home comprises a normal apartment and a separate office where he can make his trades. The office contains an “intention wheel” where he can run in order to select a currency to trade, and two tunnels that [Mr Goxx] can use to declare his intention to buy or sell the currency he selected with the wheel. The wheel is connected to an Arduino Nano with an optical encoder, and the Nano also detects the hamster’s presence in the “buy” or “sell” tunnel and lights up status LEDs when he wants to execute a trade. The Nano also communicates with an intricate Java program which overlays information on the live video feed and also executes the trades in real life with real money.

Live updates are sent directly both on Twitter and Reddit, besides the live Twitch stream of [Mr Goxx] we linked above. The stream only shows his office and not his apartment, and he’s mostly active at night (Berlin time). But we can’t wait for his random walks to yield long-term results which can be analyzed for years to come. In the meantime we’ll see if others have been able to make any profits in crypto with any less-random methods.

Random Robot Makes Random Art

For the price of a toothbrush and a small motor with an offset weight, a bristlebot is essentially the cheapest robot that can be built. The motor shakes the toothbrush and the bristle pattern allows the robot to move, albeit in a completely random pattern. While this might not seem like a true robot that can interact with its environment in any meaningful way, [scanlime] shows just how versatile this robot – which appears to only move randomly – can actually be used to make art in non-random ways.

Instead of using a single bristlebot for the project, three of them are built into one 3D printed flexible case where each are offset by 120°, and which can hold a pen in the opening in the center. This allows them to have some control on the robot’s direction of movement. From there, custom software attempts to wrangle the randomness of the bristlebot to produce a given image. Of course, as a bristlebot it is easily subjected to the whims of its external environment such as the leveling of the table and even the small force exerted by the power/communications tether.

With some iterations of the design such as modifying the arms and control systems, she has an interesting art-producing robot that is fairly reliable for its inherently random movements. For those who want to give something like this a try, the code for running the robot and CAD files for 3D printing the parts are all available on the project’s GitHub page. If you’re looking for other bristlebot-style robots that do more than wander around a desktop, be sure to take a look at this line-following bristlebot too.

Thanks to [johnowhitaker] for the tip!

Continue reading “Random Robot Makes Random Art”