random number generator

Discussion in 'The Projects Forum' started by random3, Jan 5, 2011.

1. random3 Thread Starter New Member

Dec 25, 2010
2
0
dear friends,
i need to make a random number genarator in digital logic design, Can any body tll me how to do it and what are the components to be used. By the way i want to use BCD counters and sevensegment display. i need detail plz.

Dec 19, 2007
2,584
234

Ken

3. Kermit2 AAC Fanatic!

Feb 5, 2010
3,847
963

With the right choice of sample clock rate and maybe some tweaking with the timing difference of the two IC's it would be very random.

4. jpanhalt AAC Fanatic!

Jan 18, 2008
5,699
909
Perhaps appear random. But if you can affect the number by changing the clock rate, is that not inconsistent with the definition of a random number?

I suggest collecting 1000 samples or more and submitting that output to statistical analysis.

John

5. Wendy Moderator

Mar 24, 2008
20,772
2,540
True random is harder than it sounds. I'll be following this thread with interest.

In theory it is possible to use Zener diode noise or a radio active source and use it to generate a random number.

6. jpanhalt AAC Fanatic!

Jan 18, 2008
5,699
909
Here's an interesting discussion of some of the problems, including hypothetical problems with using nuclear events. That is, does radioactive decay only appear to be random, because we don't understand it enough? Sounds like some of the religious arguments. Ah, let's don't go there.

http://www.random.org/randomness/

John

Dec 26, 2010
2,147
300
This looks like a homework assignment.

8. Kermit2 AAC Fanatic!

Feb 5, 2010
3,847
963
A TV receiver on a blank station (analog TV-remember those?)

will give you an RF noise background with random peaks and valleys in the signal. Are they truly random? Who knows.

You will of course settle for some form of pseudo-random technique.

Random - REAL random is hard to prove in a hardware device. (meaning it costs lots of \$ to get something like true random.)

9. Wendy Moderator

Mar 24, 2008
20,772
2,540
Proving it isn't that hard. It is a job for a computer though, thousands and thousands of samples, all recorded, compiled, graphed.

10. wayneh Expert

Sep 9, 2010
12,379
3,232
True, it's not hard, it's merely impossible. I get your point that "practical" randomness could be proven easily to whatever degree of precision one specifies. You'd look for a proper mean and standard deviation, normal distribution and so on. Standard statistical test might reveal a patter of some kind lurking in the data.

But we can never "prove" the lack of a pattern we don't specifically look for. A book containing the first few billion digits of pi ∏ would appear to be a random string of digits if you didn't know what ∏ is.

11. jpanhalt AAC Fanatic!

Jan 18, 2008
5,699
909
Random vs. chaotic? I agree on the philosophical "proof" part. The link I provided gave and example where the difference is demonstrable in a practical application.

John

Jan 2, 2011
2
0
Very little components edited for you (original)

schematic:

-BBK

13. djsfantasi AAC Fanatic!

Apr 11, 2010
2,900
876
How many digits are you looking for and what is the purpose of the display? For a non-critical game application, I've used a cheap pushbutton switch directly wired to the input of a decade counter and let the switch bounce generate 'random' numbers... Worked good enough for me.

14. JDT Well-Known Member

Feb 12, 2009
658
85
White noise is theoretically truly random.

For your application, why not use the fact that the time between button presses will probably be random. So have an oscillator that drives a counter and a display. The counter rotates round 1 to 6 (or whatever) continuously at rate far to fast to see. When the button is pressed, the counter is stopped at a random position.

Good enough?

15. tom66 Senior Member

May 9, 2009
2,613
214
Here is one possible circuit, built in 15 minutes.

It works by utilising small temperature drifts in components. In simulation, the results will be predictable, but in practice, it will appear random enough.

Press the button more frequently to get the "die" to roll for longer (this could be a useful function.) Also, a "stop" button can be added, to stop the die from spinning. You may want to omit this. The capacitor across the switch ensures the die starts in a random position when it is switched on.

The circuit on the ctl pin is optional but increases randomness as it modulates the frequency of the clock signal and makes it more unpredictable. The diode in the discharge path is also optional, but it too adds thermal noise and variation to the delay.

16. retched AAC Fanatic!

Dec 5, 2009
5,201
313
Here is some interesting reading on Roman Blacks website.

He has made a pretty complex random number generator In C. It isnt exactly what you are searching for, but will teach you about the ins and outs of random number generation.

http://romanblack.com/black_rng.htm

17. tom66 Senior Member

May 9, 2009
2,613
214
That looks like quite a neat random number generator.

For one way to implement a PRNG in pure logic, try a LFSR, which can be done with two or three 74xx series ICs.

18. nsaspook AAC Fanatic!

Aug 27, 2009
3,011
2,356
Another way is to use SRAM to generate random numbers or a unique key for a software PRNG or chip ID.

PIC18f8722 sram puf C18 code example.

The corrected bit pattern is a pretty good quick ID check for a tracked chip.

Last edited: Jan 6, 2011
19. #12 Expert

Nov 30, 2010
16,670
7,314
It's always interesting to watch the brightest minds debate the qualities of the most exquisite random number generators that have ever been conceived, for a kid who can't spell "please".

20. Kermit2 AAC Fanatic!

Feb 5, 2010
3,847
963
I have some extra salty popcorn, if you would like something to eat while you watch the show.