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

后端 未结 6 1405
忘了有多久
忘了有多久 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:21

    You could use this code sample: http://xkcd.com/221/ Or, you can use this book: http://www.amazon.com/Million-Random-Digits-Normal-Deviates/dp/0833030477

    But seriously, don't implement it yourself, use an existing library. You can't be the first person to do this.

提交回复
热议问题