generate random numbers with no repeat in c#

前端 未结 7 1149
萌比男神i
萌比男神i 2020-12-12 07:37

How can I generate random numbers with no repeat in C#. I have one array and I want to fill every room with random numbers from 0 to 9. Each room shoud have diffrent numbers

7条回答
  •  孤城傲影
    2020-12-12 08:14

    With such a small list of numbers to choose from you can simply generate a list that contains all of them and then shuffle them.

提交回复
热议问题