更新时间:2023-02-10 12:09:36
查看 ^ ]
RangedRandDemo方法显示如何在指定范围内生成随机数.您只需要范围0 .. 9999.
仅供参考:使用rand() % 10000
将给出该范围内的数字,但是它们不会均匀分布.对于这个游戏"问题,可能没关系.
Look at http://msdn.microsoft.com/en-us/library/398ax69y.aspx[^]
The RangedRandDemo method shows how to generate random numbers over a specified range. You just want the range 0 .. 9999.
FYI: Usingrand() % 10000
will give the numbers over that range, but they will not be uniformly distributed. For this "game" problem, that probably doesn''t matter.