Random Number

This is the place for any magazine-related discussions that don't fit in any of the column discussion boards below.
Post Reply
smoshier
Posts: 11
Joined: Wed Oct 24, 2007 6:46 pm
Contact:

Random Number

Post by smoshier » 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.

Engineer1138
Posts: 458
Joined: Thu Feb 05, 2004 1:01 am
Location: Minneapolis, MN
Contact:

Post by Engineer1138 » 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!

User avatar
Sambuchi
Posts: 366
Joined: Tue Jan 18, 2005 1:01 am
Location: Orlando FL
Contact:

Post by Sambuchi » 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.

User avatar
dacflyer
Posts: 4559
Joined: Fri Feb 08, 2002 1:01 am
Location: USA / North Carolina / Fayetteville
Contact:

Post by dacflyer » Mon Dec 17, 2007 2:53 pm

how about these ideas..

http://www.apogeekits.com/dual_electronic_dice.htm

http://www.kpsec.freeuk.com/projects/dice.htm

http://www.quasarelectronics.com/3003.htm

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

gmclam
Posts: 18
Joined: Mon Nov 26, 2007 11:48 am
Contact:

Post by gmclam » 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.

VIRAND
Posts: 88
Joined: Tue Aug 23, 2005 1:01 am
Location: New York
Contact:

Post by VIRAND » 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').

Doormatt
Posts: 7
Joined: Sat Jan 19, 2008 6:27 pm
Contact:

Post by Doormatt » 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.

Post Reply

Who is online

Users browsing this forum: No registered users and 39 guests