If you wanted to build an electronic dice, you might grab an Arduino and a nice OLED display to whip up something fancy. You could even choose an ESP32 and have it log your rolls to the cloud. Or, you could follow the lead of [Axiometa] and do it the old-school way.
The build is based around the famous 555 timer IC. It’s paired with a 4017 decade counter IC, which advances every time it receives a clock signal from the 555. With the aid of some simple transistor logic, this lights the corresponding LEDs for the numbers 1 to 6, which are laid out like the face of a typical six-sided die. For an added bit of fun, a tilt sensor is used to trigger the 555 and thus the roll of the dice. A little extra tweak to the circuit ensures the 555 keeps counting just a little while after you stop shaking. This makes the action feel like an actual dice roll.
Schematics are available for the curious. We’d love to see this expanded to emulate a range of other dice—like a D20 version that could blink away on the D&D table. We’ve covered some very exciting technology in that area as well.

Good, now put an OLED there instead and make it show a picture of the dice’s face.
also support multiple dice and more than 6 faced ones. 1d20 is the backbone of dnd
And there I made a fool of myself by not reading the last paragraph.
ducks on my way out from flying shoes
The first electronics kit I got for my daughter was the Velleman dual dice kit (WSG3400), which is a similar concept. While the cycling through each number is meant to be fast enough to be near enough random, in practice it rolls a lot of snake eyes.