Function: randomInt()
ts
function randomInt(min, max): number;Generates a random integer between min and max (inclusive). 生成指定范围内的随机整数(包含边界)。
Parameters
| Parameter | Type | Description |
|---|---|---|
min | number | The minimum value (inclusive) / 最小值(包含) |
max | number | The maximum value (inclusive) / 最大值(包含) |
Returns
number
A random integer / 随机整数
Example
typescript
randomInt(1, 10) // => a number between 1 and 10
randomInt(0, 100) // => a number between 0 and 100
randomInt(-5, 5) // => a number between -5 and 5Since
1.0.0