随机整数
Math.randInt(min: integer, max: integer): integer
生成最小值到最大值之间的随机整数。
参数2 项
| 序号 | 名称 | 类型 | 参数说明 |
|---|---|---|---|
| 1 | min | 整 | 允许的最小值,例如 1。 |
| 2 | max | 整 | 允许的最大值,例如 100。 |
返回值至少接收一个返回值
| 序号 | 名称 | 类型 | 返回说明 |
|---|---|---|---|
| 1 | number | 整 | 范围内的随机整数。
|
数学函数
Math.randInt(min: integer, max: integer): integer
生成最小值到最大值之间的随机整数。
| 序号 | 名称 | 类型 | 参数说明 |
|---|---|---|---|
| 1 | min | 整 | 允许的最小值,例如 1。 |
| 2 | max | 整 | 允许的最大值,例如 100。 |
| 序号 | 名称 | 类型 | 返回说明 |
|---|---|---|---|
| 1 | number | 整 | 范围内的随机整数。
|
Math.randStr(length: integer, mode: integer): string
按字符模式生成指定长度的随机字符串。
| 序号 | 名称 | 类型 | 参数说明 |
|---|---|---|---|
| 1 | length | 整 | 生成长度,范围为 1 至 1024。 |
| 2 | mode | 整 | 字符组成:1 小写,2 大写,3 大小写,4 大小写与数字,5 小写与数字。 |
| 序号 | 名称 | 类型 | 返回说明 |
|---|---|---|---|
| 1 | text | 字 | 生成的随机字符串。
|