According to MSDN docs the method Random.Next()
Returns a nonnegative random number. Why on earth does it return int
instead of uint
?
It seems that returning a value that would be evenly distributed over the range of the type used would make the most sense. From a usage standpoint - if you are using int
it should cover the range of int
, and if you are using uint
it should also return an even distribution over the type. Isn't that the point of using a type?
uint is not CLS-Compliant.
Here is some great reading on the topic:
http://msdn.microsoft.com/en-us/library/vstudio/bhc3fa7f(v=vs.100).aspx
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With