EveryCircuit
Contact
Reviews
Home
Issacsutt
modified 8 years ago

Random Number Generator with Memory

4
22
243
03:26:03
Originally, I was trying to create a random 4-digit code generator, but there's not enough room for all that. Note, this RNG is not truly random, but neither are most of them. This can be improved upon of course, but that would take up even more space than I really have here. A random code generator would have worked along the same principal, only it would remember the 1st digit generated, then using a counter and some more SR flip flops, it would remember the 2nd, 3rd, and 4th number as the counter determines how many times you've pressed the button, so that it could switch to the other displays at the correct time to show the previous numbers that were generated to form a random 4-digit code kinda like Google might do if you forget your password.
published 8 years ago
jason9
8 years ago
I don’t get how it works.
hurz
8 years ago
Mostlikely it does not work.
jason9
8 years ago
I’ve figured it out. I’m a bit skeptical about how random this is. I think a better one would be a counter running at, say, 100kHz and it only counts when a button is pressed and then it displays once the button is unpressed so that even a slight difference of say 1mS in the duration of the button press would cause the answer to be completely different to the point that even if the button was pressed mechanically the slight differences caused by minute fluctuations in the environment would be enough to give a 99.999% random answer.
Issacsutt
8 years ago
Using a tank circuit, when you press the button it oscillates till it dies out, the oscillations are amplified to produce clean square waves that can feed into the counter. It counts unit the oscillations die out, then it lands on a number, when you press the button again, it counts again, starting with the last number it landed on before, in theory, the tank circuit should oscillate the same number of times each time you press the button, but I think in the real world, it may oscillate 5, or 6, or 7 times because the capacitor probably won't be fully discharged when you go to press it again. But, even if this is not true, and it oscillates 5 times every time, it will still appear to be random since it starts where it left off instead of from 0. Thats the principle behind the random number generation, but to generate a random 4-digit code, the idea is it would detect when the counter has stopped counting, then it would use SR latches to remember that number (which would be the 1st digit), then using some flip flops to detect how many times you've pressed the button, it would remember the last number again but display it on a different 7-segment (so the flip flops would count 2 if it was the second time you've pressed it, then remember the number it landed on, and display it on the 1st, 2nd, 3rd, or 4th display depending on how many times you've pressed it, in this case: the second display). Unfortunately I didn't have enough space to make it generate a full code, but that's how I would have done it. And if anyone wanted, it could be modified to generate that code with just one press of a button instead of 4.
Issacsutt
8 years ago
I think thats how most of them are designed
Issacsutt
8 years ago
But I think there's one other totally different way to design it that is truly random, I've been searching online for such an approach, but I haven't found anything just yet
hurz
8 years ago
You "think" thats how most of them are designed. But you only think.
Issacsutt
8 years ago
Ok, so then how are they designed hurz?
hurz
8 years ago
I don't have enough space to answer this.
jason9
8 years ago
One way to make a truly random RNG is to rely on truly random things like the fact that certain quantum effects are 100% unpredictable. One way to do this is to amplify the thermal noise from a resistor.
jason9
8 years ago
Another way to make a truly random RNG is to amplify the noise from a reversed biased diode.
hurz
8 years ago
Right, but this "truly" random noise is limited to a bandwidth of maybe 50Hz upto several tens.kHz. So random sequences at 10Hz for example are excluded. And the distribution over this band is.probably also not flat and gives advatage to the upper or lower part of spectrum. True Random is not an easy thing.
Issacsutt
8 years ago
That's what I read earlier, but what exactly I'd meant by "quantum effects"?
Issacsutt
8 years ago
is*
jason9
8 years ago
Molecular effects are those at the molecular level. Atomic effects are those at the atomic level. Subatomic (everything smaller than atomic) effects are those at the subatomic level. Quantum effects are the effects ate the quantum level. Atoms are made up of protons and neutrons, and those are the largest subatomic components. Protons and neutrons are made up of quarks, which are at the quantum level. If you want to know what quantum effects are, well, let’s just say that they are very very confusing, complex, and defy common sense more times than they actually make sense.
jason9
8 years ago
One example of quantum effects is the wave-particle duality. The way that works is that when viewed, something always comes out as a particle type thing, but when not viewed, they behave like a wave. Photons, for example they always strike a very specific spot on the lens of a camera, but if they are put through a certain device then the spread of where they are most likely to hit the lens and least likely to hit the lens shows a distribution in overall intensity only seen with waves.
jason9
8 years ago
This specific effect is even seen in things that are most definitely particles and not waves, like large molecules such as the buckyball (a hollow sphere of about 60 carbon atoms (I don’t remember the exact number, but it was somewhere around there)). Are we actually just big waves? Or are the fact that we are constantly viewing ourselves preventing us from being waves? Who knows.
Issacsutt
8 years ago
I already knew the molecular -through- the quarks point that you made, though I never knew quarks were considered to be at "quantum level". I've heard about the particle thing before, where they say it cannot be observed (you cannot know the speed and location of a partial at the same time), but about us on Earth, and photons, what do you mean we are constantly viewing ourselves, and about viewing photons, is all this proven?
jason9
8 years ago
I figured you probably knew about the molecular through subatomic at least. Those last couple of sentences about us viewing ourselves and us being waves were just a little bit of speculation on my part. The part about photons I got from wikipedia, so it’s been proven.
Issacsutt
8 years ago
Yeah, very interesting! I've heard about quantum entanglement a bit too, but not 100% sure about all that. Then people talk about quantum computers, which is based on what; values between 0 and 1 from which the binary system every other computer is based on, is all this just imaginative or reality? Quantum...? Hmmm.
jason9
8 years ago
Quantum entanglement is where two particles are locked together in way like they share the same spin or whatever. If one particle changes, then the particle it’s entangled with will change in the same way. The speed at which they “communicate” is faster than the speed of light, but unfortunately faster than light communication is impossible with it due to other quantum effects that make it so that it would be impossible to detect the change in the particle without slower than light communication between the two particles via radio or verbal communication. I’ve heard some about quantum computers too, but I’m not sure what they’re about. I think it might have something to do with utilizing certain complex quantum effects abilities to “compute” something that would take a lot longer for a regular computer to compute. There’s probably a lot more to quantum computer than just that.
maxmax_66
8 years ago
@jason9. You are indeed correct with respect to the notion that we, like subatomic particles, are 'wavelike' as well. However, the combined wave equations result in a wave equation and associated wavelength to small to measure. Unlike photons, electrons, protons, etc, it would not be practical nor feasible to design a double-slit type apparatus or any other experiment to show our wavelike nature, so we're stuck being more particle like. On that score, it's important to clarify what is meant by an observation, or more accurately a measurement, in the context of quantum mechanics. We make measurements on the state of a particle by designing an apparatus which reflects which aspect of the particle we wish to measure. If we want to measure, say the position of a particle more accurately than its momentum, we would design an experimental apparatus that would reflect a particle's more 'particle' like nature. Basically, our apparatus would make a measurement, collapse the wave function, and give us a definite position for our particle and by extension reveal its particle like properties since waves by definition do not have a definite position. Alternatively, an apparatus designed to measure the momentum of a particle more accurately than its position will reflect a particle's more wavelike aspects. Again, our apparatus would make a measurement, collapse the wave function and give us its momentum and by extension reveal its wavelike properties, since waves have well defined momentum but do not take on a well defined position. It is the act of measurement which collapses the wave function and forces the particle to take a 'stand'. Therefore, depending on which apparatus we use to make measurements, we will observe either a particle's wavelike properties or its particle like properties thus revealing the wave-particle duality of all matter. I hope this clears things up a bit. :)

EveryCircuit is an easy to use, highly interactive circuit simulator and schematic capture tool. Real-time circuit simulation, interactivity, and dynamic visualization make it a must have application for professionals and academia. EveryCircuit user community has collaboratively created the largest searchable library of circuit designs. EveryCircuit app runs online in popular browsers and on mobile phones and tablets, enabling you to capture design ideas and learn electronics on the go.

Copyright © 2026 by MuseMaze, Inc.     Terms of use     Privacy policy