Generating random numbers without repeating.C#

前端 未结 11 1860
臣服心动
臣服心动 2020-12-01 17:53

Hi everyone I am trying to generate 6 different numbers on the same line in c# but the problem that i face is some of the numbers are repeating on the same line.Here is my c

11条回答
  •  时光取名叫无心
    2020-12-01 18:06

    If you are not worried about the min, max, and range then you can use this.

     var nexnumber = Guid.NewGuid().GetHashCode();
            if (nexnumber < 0)
            {
                nexnumber *= -1;
            }
    

提交回复
热议问题