0
How the random number generater generate the number is there any pattern if numbers are generated in very large quantity
6 Antworten
+ 3
Exactly, Anhjje. Even in a natural sense, random is always based upon something even if we don't recognize what it's based upon. No such thing as random beyond a concept.
+ 2
The best way that I've found to create "random" numbers is to base it on the epoch time since it's always changing every millisecond.
+ 2
Even more, any thing that we call random is in a way determined.
If we take the example of a dice roll, at the exact instant it leaves our hand, it's result can be computed if we know precisely every variables of it's movement, so it's not really random anymore (by the laws of physics)
We could start a debate here about chaotic systems here (for example about a chaotic pendulum) and wether or not their movement are random or not, but technically, even if a tiny variation (of a micron, for example) may lead to a totally different result, knowing perfectly every variables at the start, we can predict how it's going to behave
+ 1
Well there's nothing that can be qualified as random when it comes to programming, as everything works with functions and variables.
Though, about random number generators, they often works with a seed (a number that will condition the set of elements you'll get). It is generally optional and if you don't give one explicitly, one is generated within the function, based on things like current time.
Knowing the seed, you'll know every number given by the generator, but finding a pattern may be really hard since it's goal is to seem random.
Then it all relies on implementation details, which may not be communicated :/
Here's an example of a RNG if you're curious
https://www.geeksforgeeks.org/pseudo-random-number-generator-prng/
+ 1
By the way, if you're really interested, this video might give you some more information about random in general :
https://youtu.be/9rIy0xY99a0
+ 1
Good answers, programs can only do pseudo random and if you want to get philosophical, what is random anyway? You always pick a number based on some preference / Mathematical equation