← API.MAO.MS home中文

Random Numbers API

Free, no key required. For draws and lotteries, verification codes and random passwords, test data, UUID assignment and more.

Where the randomness comes from

Numbers are drawn from the server's operating-system entropy pool (getrandom): hardware randomness from the host and system entropy feed the kernel's cryptographically secure generator (ChaCha20). No predictable pseudo-random algorithm is used anywhere (no PHP rand / mt_rand, no Math.random). Every call draws fresh numbers, and responses are never cached.

API reference

Base path /v1/random. All endpoints are GET and return {code, message, data}. Add lang=en for English error messages.

GET /v1/random/int Random integers

ParameterDefaultNotes
min1Minimum (inclusive)
max100Maximum (inclusive)
count1How many, 1–1000
Request: /v1/random/int?min=1&max=100&count=3
Response: {"code":0,"message":"ok","data":{"min":1,"max":100,"count":3,"numbers":[8,66,78]}}

GET /v1/random/string Random strings

ParameterDefaultNotes
length16Length, 1–1024
typealnumPreset sets: digits / lower / upper / alnum / symbols (alnum + symbols)
charset—Custom character set — takes precedence over type. Unicode-safe (CJK works), duplicates removed, max 256 unique characters, no whitespace or control characters.
Request: /v1/random/string?length=16&type=alnum
Response: {"code":0,"message":"ok","data":{"length":16,"type":"alnum","string":"RYNbBOJV5xSmGy4Z"}}

Request: /v1/random/string?length=8&charset=abc123
Response: {"code":0,"message":"ok","data":{"length":8,"type":"custom","charset_size":6,"string":"3b2ac1ba"}}

GET /v1/random/uuid UUID v4

ParameterDefaultNotes
count1How many, 1–100
Request: /v1/random/uuid
Response: {"code":0,"message":"ok","data":{"count":1,"uuids":["afee4e2c-16f8-4b71-a8d0-31187758fb2d"]}}

GET /v1/random/float Random floats

ParameterDefaultNotes
min0Minimum (inclusive)
max1Maximum (exclusive)
precision6Decimal places, 0–15
Request: /v1/random/float?min=0&max=1&precision=6
Response: {"code":0,"message":"ok","data":{"min":0,"max":1,"value":0.045965}}

GET /v1/random/shuffle Sampling without replacement

Shuffles the range and draws from it — no repeats. Made for lotteries and draws.

ParameterDefaultNotes
min1Minimum (inclusive)
max49Maximum (inclusive)
count5How many; must not exceed the range size
Request: /v1/random/shuffle?min=1&max=49&count=5
Response: {"code":0,"message":"ok","data":{"min":1,"max":49,"count":5,"numbers":[23,31,20,29,19]}}

Usage stats

The random endpoints have been called 13 times in total · 13 today. See the full usage stats.

EndpointPathTodayTotal
Random integers/v1/random/int44
Random strings/v1/random/string22
UUID/v1/random/uuid33
Random floats/v1/random/float22
Sampling without replacement/v1/random/shuffle22
Index/v1/random00

Live test

Press a button — the live API response will appear here.