Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

Random Number Generator

Status
Not open for further replies.

Primar

New Member
Where can I find a circuit design for a random number generator? I've tried looking on Google, but only came up with University projects involving Geiger counters etc., and online random number generators. I'm taking electronics for GCSE, so nothing too complex, please. It really doesn't matter if the numbers are truly random.

At the moment, I'm currently considering mutilating 3 electronic dice circuits from www.maplin.co.uk , and putting them together to make a 3 digit number generator. Does anybody have a circuit design, or a better idea than the one I suggested?
 
random?

if it really doesn't have to be truly random, the simplest circuit is a pseudo-random, maximal length linear feedback shift register. Look up LFSR on Google and you'll quickly find some circuits. It's basically a serially connected line of flip-flops with strategically placed XOR gate(s) providing feedback. Sampling a relatively long shift-register sequence, (n=127 for ex), will provide an essentially random output. Sequence repeat times of trillions of years (assuming the computing power common on todays machines) are easy to generate. The hard part is coming up with the feedback taps (prime over the Galois field, whatever that means. Damn it Jim, I'm an engineer, not a mathematician). Fortunately, the work's already been done for you and it's available on the web. I don't have the website handy, but a very generous minded mathematician (french, I think. I ran across it about 9 months ago) has posted all taps up to 512 or so on his website. Again, do a google search. Good luck.

- CAL
 
more randomness

ok, I'm curious. I think the LFSR is the simplest digital method of generating a "random" number output. Does anyone have an analog counterpart that can easily be converted to a digital output? (maybe a diode noise generator coupled with a low cost serial A/D?) I ask because there are so many more random variables to deal with in the analog domain, temperature, supply voltage, component ageing, etc. The things that are normally compensated for might provide a better solution than an all digital one, not something I'd often claim...
 
Does anyone have an analog counterpart that can easily be converted to a digital output? (maybe a diode noise generator coupled with a low cost serial A/D?)

Laroche, ive recently bin thinking about that when i was posting to the electronic dice thread. Does a noise signal really need to be converted ?
If a noise spike of sufficient length and amplitude can "trigger" an input, conversion shouldnt be necessary. An ordinary transistor will generate some noise , as will a diode, but im just wondering is there some predictable pattern to it ? Temperature will have an effect on this as well, im assumming.
 
random # generators

That's an interesting thought, where the "conversion" is done simply by triggering a timer.

What the output will be used for helps in deciding what kind of random number generator method to use.

LFSR generators can provide an output that is "random enough" for many applications. In other words, if the end user perceives the output as being random for a given application, a psuedo-random generator may work fine. The problem with using LFSR generators for things like cryptography is that they're based on a repeating sequence. It may be an incredibly long sequence, but it ultimately repeats. LFSR generators have been researched exhaustively for cryptographic use, and given a relatively small output sample, the originating generator configuration can be reconstructed (at least that's what my web search turned up).

btw, here's an app note listing the appropriate taps for LFSRs of up to length n=168. FPGA's provide an efficient means of constructing long LFSRs, due to their register heavy architecture.

**broken link removed**

If operating speed isn't a primary concern, a small micro can also do the job very simply. Check this link, it's one I posted under the lamp-dimmer thread, but also has a pn generator based on a PIC 12C508A.

http://www.e-insite.net/ednmag/contents/images/32102di.pdf


btw, a LFSR with n=168 and using a 10Mhz clock would have a sequence repeat time of ~ 10^36 years.
 
Ok, thanks for all the advice. I'll try my best at fudging it all together... :)
 
If the random numbers are requested as the result of some human input, the following circuit could be used...

An oscillator is connected to the clock of a modulo counter (i.e. one that loops back to zero after reaching its maximum value). When a number is requested, the clock is disabled, causing the counter to stop on a particular number. If the time taken for the counter to count through it's entire range is much less than the minimum time between user requests, the output will be for most purposes random.
 
:D hi primar, have you found the circuit you're looking? if not i have the circuit for a 3 digit display. it uses the 555, MC14553B or CD4553 3-digit BCD counter, 74LS47 BCD to 7 segment decoder driver and 3 common transistors and operates at 6v. if you're interested, just email me here or my other email add: floyd2949@myway.com :D
 
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Back
Top