13305Views17Replies

Author Options:

Random number generator Answered

I am looking to purchase or looking to make or looking for someone to make or show me how to make a simplistic ramdom number generator with a simple 2 digit lcd readout. This will be used as an automatic dice roller for a board game. The random numbers can be fixed to read out from 1 - 12 or even up to 24. Or, if not too difficult, programble, to make it more versatile Perhaps a prototype could be made by using some existing components such as from a digital clock or watch. Can anyone tell me if; 1. There is anything like this on the market? 2. There is an easy, inexpensive way to built something like this? Or 3. If someone would be interested in building something like this for me?

Discussions

What kind of dice are you trying to simulate?

good point. A normal pair of dice won't roll a "1", and tends to roll lots of "7"s. A random 1-12 picker is like a DnD dodecahedron, or a clock face spinner.

0
user
westfw

11 years ago

From a logistics point of view, you're going to have trouble finding a 2-digit LCD display like that at a reasonable price. LCD "glass" tends to come in a few standard formats (clock display), and "custom designed." It would be a lot easier to do in LEDs, and THAT'S been done many a time (though I don't know offhand whether there's one with a XdY (X dice with Y sides each, ala DnD) programmable capability. It shouldn't be hard. Electronic Dice Kit might be a good starting place.

(or, you might be able to use a cellphone display, if you can find one that's well documented.)

Thank you westfw, I've ordered one and will try it out. Regarding the price; Well this comes from the UK (I'm in WA State, USA) so after the shipping and converting Sterling Pounds into USD it's running $35+.

Sorry about the price; a lot of these kits are manufactured off in China/etc and sold by many vendors, so I didn't bother looking specifically for a US source. Although now that I have, I can't find one anyway... Note that the 18pin PICs all have compatible pinouts, so you should be able to drop in a more-hobbyist friendly chip instead of the one that comes with the kit, if it has a socket...

Thanks westfw, Yes, I plan to examine the components and see if I can purchase what I need, locally, to build a couple of these. I think that most of the components will be common and readily available but can you give me some idea about what I will need to look for as far as a "processor" (the component that generates the numbers)? Thanks, Charles P.S. sorry for the double posting. I'm new here and did not know if these were different forums or not.

Well, you can look at the How to Choose a Microcontroller instructable. For two 7-segment displays, you probably want to have 9 output pins, and a couple inputs to select max value or whatever. Unfortunately, that'll eliminate some of the lower cost "easy" solutions like the basic stamp 1 or PICAXE (which only have 8 outputs, as far as I can tell.) But you should be well within the capabilities of 14 to 18pin PICs or AVRs. (or, come to think of it, you could probably implement this on the $20 Atmel Butterfly Evaluation Board

There is no such thing as a true digital random number generator. This is why they're called pseudo-random. You could get a random number by incrementing the number looping from 1 to 12 as quickly as the circuit would allow and display the current count when the user presses the button. In this situation, the random action is the time it takes the user to press the button.

I agree, just going to say the same thing, the only true random number generator must count very fast and be stopped by the "observer". No uC is needed... (a couple of TTL's and LED display is cheap+simple) Digital watch... hmmm... if you can overclock one (much faster crystal), and just use the set-hour mode ... there you go! Just like the picture.

0
user
CSUjr

11 years ago

Thanks for your reply. As long as it will generate different numbers, it sounds like it will be okay for what I want. Do you have any suggestions on either, where I can get one, get one made, or make one myself? Charles