How do I generate a random int number?

前端 未结 30 2635
长发绾君心
长发绾君心 2020-11-21 11:02

How do I generate a random integer in C#?

30条回答
  •  攒了一身酷
    2020-11-21 12:04

    You could use Jon Skeet's StaticRandom method inside the MiscUtil class library that he built for a pseudo-random number.

    using MiscUtil;
    ...
    
    for (int i = 0; i < 100; 
        Console.WriteLine(StaticRandom.Next());
    

提交回复
热议问题