rnd.Next(0, 1) returns the value of i in the range 0 <= i < 1 . The only such value is 0 .
Take a look at the documentation :
Minvalue
Type: System.Int32
An inclusive lower bound for a random number is obtained.
Maxvalue
Type: System.Int32
The exceptional upper bound of the random number is back. maxValue must be greater than or equal to minValue.
Please note that minValue is inclusive and maxValue is exclusive. Thus, in more general terms, this overload of next() returns values ββin the range:
minValue <= i < maxValue
If you do not know the terminology, in the context of inequalities inclusive means <= or >= and exceptional means < or > .
Well, the above inequality is not strictly true in the case of minValue == maxValue, but I prefer to neglect this corner case for a cleaner presentation.
source share