How to generate “random” but also “unique” numbers?

后端 未结 6 1414
忘了有多久
忘了有多久 2021-02-05 21:32

How are random numbers generated.? How do languages such as java etc generate random numbers, especially how it is done for GUIDs.? i found that algorithms like Pseudorandomnumb

6条回答
  •  灰色年华
    2021-02-05 22:12

    There are a lot of ways you could generate random numbers. It's usually done with a system/library call which uses a pseudo-number generator with a seed as you've already described.

    But, there are other ways of getting random numbers which involve specialized hardware to get TRUE random numbers. I know of some poker sites that use this kind of hardware. It's very interesting to read how they do it.

提交回复
热议问题