Page 1 of 1
Posted: Sun Dec 16, 2007 9:31 pm
Anyone know of a way to do random number generation?
I want to have a dice-rolling circuit, but I don't know how to do the random number. I don't want to use the software-default because I don't know what type of processor I am using.
Posted: Mon Dec 17, 2007 12:08 pm
Reverse-biased diode noise generator with a comparator to produce digital output followed by a counter that rolls over at 6? Should work in theory!
Easier to use a processor!
Posted: Mon Dec 17, 2007 1:28 pm
read the heat off something on board and use the least sig.
Some processors have built-in temp senors... or use a ADC.
Posted: Mon Dec 17, 2007 2:53 pm
how about these ideas..
maybe that will work for you..
i have one here that i made long time ago, it was a radio shack kit..
from way back,
maybe i might still have the plans on it, i'll look in my archives
Posted: Fri Jan 04, 2008 2:41 pm
Random number generation does not have much to do with the type of CPU you're using. You can perform some form of RNG on any CPU. There are a lot of approaches to getting a truly random value, and it works best if you're able to somehow tie that to an "external" event. For example, upon power up the CPU could run a counter. When an external event (someone pushing a button?) occurs, reverse the counter direction and/or XOR it with a saved value.
When you need the random number, just use some of the bits of the counter. For dice, you'll only need 3 bits (which is a count of 0-7), but they can be any 3 bits from a larger counter.
If you don't have truly external events to trigger from, there are some algorithms out there which can give you psuedo random results. They could generate 1000s of values before repeating; something no one would realize is not random.
Posted: Sat Jan 12, 2008 8:26 am
Running counters that are read when a button is pushed or released is
the ONLY possible true random number generator. All pseudorandom
number generator routines are actually bizarre and predictable counters,
which simply don't count in order and also eventually repeat when they
overflow. At best, PRNGs are like calculating digits of Pi, which always
remain the same, but are "fair" (as in 'unloaded dice').
Posted: Sat Jan 19, 2008 7:04 pm
Actually, for anything where security is required, reading a counter is about the worst possible way to implement a PRNG.
The best way to create a PRNG is to use physical phenomenon, such as avalanche diodes.