GET
实用工具
随机数生成
生成指定范围、指定个数的随机整数。
累计调用 9
今日调用 0
更新于 2026-10-16
调用地址
GET
https://itapi.top/api/randnum
请求参数
| 参数名 | 类型 | 必填 | 说明 | 示例 |
|---|---|---|---|---|
| min | int | 可选 | 最小值,默认 1 | 10 |
| max | int | 可选 | 最大值,默认 100 | 10 |
| n | int | 可选 | 生成个数,默认 1 | 1 |
返回字段
| 字段名 | 类型 | 说明 |
|---|---|---|
| code | int | 状态码 |
| data.numbers | array | 随机数数组 |
| data.first | int | 第一个数 |
响应示例
200 OK
{"code":200,"msg":"success","data":{"min":10,"max":10,"count":1,"numbers":[10],"first":10}}
在线测试
代码示例
cURL · GET
curl "https://itapi.top/api/randnum?min=10&max=10&n=1"
PHP
<?php
$res = file_get_contents("https://itapi.top/api/randnum?min=10&max=10&n=1");
$json = json_decode($res, true);
print_r($json);
JavaScript
const res = await fetch("https://itapi.top/api/randnum?min=10&max=10&n=1");
const json = await res.json();
console.log(json);
Python
import requests
r = requests.get("https://itapi.top/api/randnum?min=10&max=10&n=1", timeout=10)
print(r.json())