关于产生指定范围内的随机数字
求教,我想产生一指定范围内的随机数字 比如:产生的数字必须在 15206 到 26584 之间 该怎么写呢?
请指教
2005-10-18 14:57
2005-10-18 15:12
2005-10-18 17:13
2005-10-18 17:23
要产生指定范围的随机整数,请使用以下公式:
Int((upperbound - lowerbound + 1) * Rnd + lowerbound)这里, upperbound 是此范围的上界,而 lowerbound 是此范围内的下界。
注意 要重复随机数的序列,请在使用数值参数调用 Randomize 之前,立即用负值参数调用 Rnd。使用同样 number 值的 Randomize 不能重复先前的随机数序列。

2005-10-18 17:24
2005-10-18 19:09
2005-10-19 01:39