- 论坛徽章:
- 0
|
回复 #6 xn_sung 的帖子
$[($RANDOM%1000)],还是不懂
RANDOM Each time this parameter is referenced, a random integer between 0 and 32767 is generated. The sequence of random numbers may be initial-
ized by assigning a value to RANDOM. If RANDOM is unset, it loses its special properties, even if it is subsequently reset.
这个随机数只在0-32767 之间,所以 RANDOM%1000不会大于1000
[2]echo $[ RANDOM ]
17598
[2]echo $[ RANDOM ]
15081
[2]echo $[ RANDOM ]
7025
[2]echo $[ RANDOM ]
11673
[2]echo $[ RANDOM ]
14341
[2]echo $[ RANDOM ]
28362
[2]echo $[ RANDOM ]
9957
[2]echo $[ RANDOM%1000 ]
97
[2]echo $[ 28362%1000 ]
362
[2]echo $[ 14341%1000 ]
341 |
|