C#Random.Next - 永远不会返回上限? [英] C# Random.Next - never returns the upper bound?
本文介绍了C#Random.Next - 永远不会返回上限?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
random.Next(0,5)
据从未返回5(但有时返回0)为什么?我想这些都是可以退换只是边界值。谢谢
It never returns the 5 (but sometimes returns the 0.) Why? I thought these are just boundary values that can be returned. Thanks
推荐答案
的 maxValue(最大值)
的上限在下一页()
方法的独家 -the范围包括 minValue(最小值)
, maxValue(最大值) -1
,以及两者之间的所有数字。
The maxValue
for the upper-bound in the Next()
method is exclusive—the range includes minValue
, maxValue-1
, and all numbers in between.
这篇关于C#Random.Next - 永远不会返回上限?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文