![Cover image for Are Random numbers really random?](https://media.dev.to/cdn-cgi/image/width=1000,height=420,fit=cover,gravity=auto,format=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fx59fgy7saelm9g6uqt6o.jpg)
So recently a thought struck me that we use random functions in our software all the time right? Either in games or in machine learning models, cry...
For further actions, you may consider blocking this person and/or reporting abuse
Truly random number generators do not exist, since true randomness is only a theoretical concept.
Well True Random generators do exist, here is a site which let's you generate True Random numbers - random.org/
They have also explained how they are generating these true randoms
The fact that they can explain their method makes them not random. For something to be truly random, it would depend on nothing, and be 'chosen without method'. It's a purely theoretical concept.
Doesn't truly random mean that you can't predict it? What does it have to do with "chosen method"? I mean they are relying on environment and I think that's random enough right?
With enough information, you could predict that. That's the point.
You said it correctly with your phrasing 'random enough' - it's probably beyond the practical reach of anyone to predict it... but that doesn't make it truly random.
random.org seems based on "atmospheric noise" as they said. I didn't check the details, but this seems chaotic enough to make the random sequence be unpredictable in practice.
There is also qrandom.io/, which seems to generate random values based on quantum random generator. These generators are truly unpredictable, even if you know the exact state of the whole universe.
So we can say that TRNGs exist maybe not scientifically 100% truly random but yeah , right?
As I know, (I have good scientific background, but I'm not an expert), quantum mechanism is non-deterministic.
When you flip a coin, if you exactly know its mass, its speed, the gravity, etc... you can predict on which face it will fall. So, even if you have 50% chance having heads, 50% tails, there is a way to predict the actual value. Its like for PRNG. If you exactly know the system, you can predict it.
BUT, assuming you flip a "quantum coin", you know it has 50% chance having heads, 50% tails, but you CANNOT predict the result. It's difficult to understand, but even if you put your coin under a microscope, even if you know the exact state of the coin, you cannot predict the value you will read. So, quantum based random generator are... truly random. You cannot predict them, even if you know in which state they are.
I think this information is enough to explain someone who doesn't have enough quantum realm info (like me) so thanks for that
Again this is an assumption based on incomplete knowledge, but probably again 'random enough'.
The funny thing is, 'true' randomness is impossible to check for because... what would you check for?
I think this is a topic where you can't either agree or disagree, what you think?
No no no, it's not non-deterministic because we have incomplete knowledge. It has been proved to be non-deterministic, and not because of chaotic behavior or imprecision in measure, or incomplete knowledge, but in essence. There are formal demonstration that involve high level mathematic I don't even understand, but I trust the guys that did it 😊
One of the explanation is that, you just cannot know the exact state of a quantum system because of Uncertainty principle.
By analogy, to measure something, you have to "light it up". Else, it's just dark and you see nothing. But if you "light it up", you send energy in the system, that will interact and change its state. So you cannot measure a system without changing it, even a little bit. But to predict a system, you have to know its current state. So you have to measure it. So, you will change its state...
In the end, it is impossible to know the current state of a quantum system. That's why we say it is in "state overlap". We know the probability for the system to be in one or the other state, but we don't know which one, until we measure it. But as we saw, measuring it change its state 🤪
You can disagree with this. But this means you disagree with the whole quantum physic. You can, and that's how science advances. But up to you to find a better model 😉
No, I think at this point I can't disagree, this explanation is enough to prove that TRNGs do exist. And it's a good one and now I have gotten an interest in reading about Quantum real a bit too maybe I won't get it? But what's the harm in checking it out right?
We have incomplete knowledge of quantum physics - it is something we made up to fit observations, it isn't an absolute. To the best of our knowledge, it appears to be non-deterministic, but we don't know that for sure. A random number depending on it is depending upon a human assumption that could well be wrong.
I've studied physics, and understand the uncertainty principle - but there's nothing to say that a discovery tomorrow couldn't suddenly render all the theories of quantum physics wrong - or not as non-deterministic as we thought.
Truly random is an abstract, unachievable concept - but we can get close enough to it to the ideal to make it 'random enough' for our purposes.
I think any generator is called a True random generator as long as any "human" can't predict it, as @tandrieu also pointed out that no one can predict the state in the quantum realm, "no one" and this no one is us the humans and as long as humans can't find a way to predict it, it can be called True random right? I mean we do need to find a difference between generators we can predict right now vs the ones we cant right?
No-one can predict quantum states yet - but we cannot assume this will never be the case - and for the same reason we cannot call a RNG based on it truly random.
For something to be truly random - as the defintion of the word 'random' states - the event should be:
i.e. free of any outside, measurable influence. An effect without a cause if you will. To my knowledge, no known mechanism for this exists... and things that claim to be have just come from theories posited by scientists to explain their observations. There is no way to prove true randomness - that would be contradiction in itself, but we certainly cannot say that something is truly random if it is relying on assumptions/theories.
If you want the definition of a TRNG to be one that produces output that cannot be predicted by any human right now - then fine - TRNGs definitely do exist... and I don't doubt that.
Trying to make something truly, completely random though - is a fool's errand.
Funny thing is - it was actually my physics professor who explained this.
Haha, you do have a lot of knowledge about this topic. I'm sure you must have had a good debate with your professor as well? Also, I'm sure people will learn a lot from the comment section alone now. Haha!
Interesting debate 😊
For quantum state, I have doubt we manage one day to predict them. The model seems quite robust, and has for now resisted to all tests to fail it. If we manage to do such a thing, the whole quantum physic would collapse, and we would have discovered a brand-new science. God, that would be so awesome !
Mathematic contains an infinity of things that cannot be demonstrated. They are just "true" (or "false"), and you have to admit it. I'm quite sure real world also contains those kinds of singularities. Thing that are "just the ways they are".
That's the great thing about Science - we never really know if it's "correct", and good science will always be open to new evidence, interpretations, and theories - which, if proven - will refine our understanding.
Newton was wrong. So was Einstein. And that’s okay… | by Deep Breadth | Medium
Deep Breadth ・ ・
Medium
Thanks for sharing this blog, looks interesting and surely matches our discussion
Yea but it's good enough for our uses
Agreed 💯
Unfortunately the assumption that all random functions somewhere are PRNGs is wrong. We have true random number generator built into hardware. Since these are usually quite slow they mostly serve as seed input for a PRNGs.
Most likely of your machine can also produce real random numbers using the RDRAND instruction.
Yeah, I agree and that's why I only mentioned the programming language's random functions, although am curious how does hardware generates this random number? Atmospheric noise? I thought for PRNGs we normally use timestamp.
That depends on the hardware RNG - it can be thermal-based / brownian motion, but atmospheric noise or general current fluctuations are also a viable source. There are also more sophisticated methods. In general such hardware RNGs don't give better performance (as mentioned they are quite slow) and are also not used in applications where randomness is crucial (the classic MT19937 is still sufficiently good). They are good, however, for cryptographic applications under certain circumstances (e.g., OpenSSL allows you to use them).
If you refer to timestamps for the seed of a PRNG that can be true (in cases no seed has been given), but then again it fully depends on the framework and usage. Consider
/dev/random
- they use a mix of different sources incl.RDRAND
(and similar likeRDSEED
) if available. Exceptions (based on the used distro) exist.Wow.. I remember using
Random.nextInt()
for testing against a test case. I was curious but was too lazy to know what goes underneath. Now, I understand the underlying mechanism.Glad I was able to help you understand something 😁
TLDR; truly random numbers aren't feasible but we do have some ways to create numbers that are "random enough" for most purposes.
Haha, that does sum up the blog
It was great
Ho, yeah, the good old Rapid Racer on PS1 and its fractal generator !
Haha never played it but based on your given link it does looks cool, reminds me of boats in GTA vice City
Be like Cloudfare, record bunch of lava lamps and hash the image into numbers.