Understanding “randomness”

前端 未结 28 2617
轻奢々
轻奢々 2020-11-22 15:28

I can\'t get my head around this, which is more random?

rand()

OR:

rand() * rand()

I´m f

28条回答
  •  时光说笑
    2020-11-22 16:13

    OK, so I will try to add some value to complement others answers by saying that you are creating and using a random number generator.

    Random number generators are devices (in a very general sense) that have multiple characteristics which can be modified to fit a purpose. Some of them (from me) are:

    • Entropy: as in Shannon Entropy
    • Distribution: statistical distribution (poisson, normal, etc.)
    • Type: what is the source of the numbers (algorithm, natural event, combination of, etc.) and algorithm applied.
    • Efficiency: rapidity or complexity of execution.
    • Patterns: periodicity, sequences, runs, etc.
    • and probably more...

    In most answers here, distribution is the main point of interest, but by mix and matching functions and parameters, you create new ways of generating random numbers which will have different characteristics for some of which the evaluation may not be obvious at first glance.

提交回复
热议问题