How do I generate random number between 0 and 1 in C#?

前端 未结 6 860
迷失自我
迷失自我 2020-12-10 11:55

I want to get the random number between 1 and 0. However, I\'m getting 0 every single time. Can someone explain me the reason why I and getting 0 all the time? This is the

6条回答
  •  情歌与酒
    2020-12-10 12:25

    Because you asked for a number less than 1.

    The documentation says:

    Return Value
    A 32-bit signed integer greater than or equal to minValue and less than maxValue; that is, the range of return values includes minValue but not maxValue. If minValue equals maxValue, minValue is returned.

提交回复
热议问题