Why is it hard for a program to generate random numbers?

后端 未结 26 3274
自闭症患者
自闭症患者 2020-12-15 05:38

My kids asked me this question and I couldn\'t really give a concise, understandable explanation.

So I\'m hoping someone on SO can.

相关标签:
26条回答
  • 2020-12-15 06:22

    Generating random numbers on a computer is like playing "Eenie meenie miney moe" when choosing who's It first in a game of tag. On the surface it does look random, but when you get into the details, it's completely deterministic. It's hard to make eenie meenie miney moe into a scheme that a person really can't predict the outcome of.

    Also there's some difficulties with getting the distribution nice and even.

    0 讨论(0)
  • 2020-12-15 06:25

    Because there is no such thing as a random number.

    Random is a human concept that we use when we cannot comprehend data and do not understand it. If we are to believe that science will ultimately lead to an understanding of how everything works then surely everything is deterministic.

    Take away the human and there is no random there is only "this". It happens because it happens, not because it is random.

    0 讨论(0)
  • 2020-12-15 06:26

    Because computers are deterministic machines.

    0 讨论(0)
  • 2020-12-15 06:27

    Its probably helpful to distinguish between a number that is hard to predict (which a computer can create) from something that is not deterministic (which is a bit tougher for computers, and theoretically, any physical being).

    0 讨论(0)
  • 2020-12-15 06:29

    A simple explanation for the children:

    The definition of randomness is a philosophical and mathematical question, beyond the scope of this answer, but by definition there is no such thing as a "random" number. In a metaphysical sense, a number is only random in sequential form; however, there is a probability that a sequence follows certain statistical distributions depending on the sample size. A random number generator (in our case a pseudo-random number generator, or PRNG) is simply a device to produce a quasi-random sequence of numbers that we can only estimate (based on the given probability inherent within the sequence) to be random.

    You should explain to the children that programs can only mimic these devices using complex mathematical formulas (which guarantee a lack of "randomness" by definition because they are a result of some function, or procedural algorithm). Typically, rigorous statistical analysis is necessary in order to differentiate the use of a quantum hardware PRNG (use this as an opportunity to explain to your kids the Heisenberg Principle!) and that of a strong software PRNG.

    0 讨论(0)
  • 2020-12-15 06:29

    Algorithms to generate random numbers are inevitably deterministic. They take a small random seed, and use it to obtain a long string of pseudo-random digits.

    It's very difficult to do this without introducing subtle patterns into the data. A string of digits can look perfectly random but have repeated patterns which make the distribution innappropriate for applications where randomness is required.

    0 讨论(0)
提交回复
热议问题