← Fun & Random

Random Number Generator

Generate cryptographically random numbers in your browser. Nothing leaves your device.

Settings

Number type

Result

Use this tool from AI agents

This tool's engine is available to AI agents over MCP as random_number. Add the Clean.tools server, then your agent can call it directly.

Claude Code
claude mcp add --transport http clean-tools https://mcp.clean.tools/mcp
Claude Desktop (mcpServers)
{"mcpServers":{"clean-tools":{"command":"npx","args":["-y","@clean-tools/mcp"]}}}
Cursor
https://mcp.clean.tools/mcp

Or call it over plain HTTP from any script. Same engine, JSON in and JSON out, no key:

curl
curl -s https://api.clean.tools/v1/random_number \ -H 'content-type: application/json' \ -d '{"min":1,"max":100,"count":5,"type":"integer"}'
JavaScript
const res = await fetch("https://api.clean.tools/v1/random_number", { method: "POST", headers: { "content-type": "application/json" }, body: JSON.stringify({ min: 1, max: 100, count: 5, type: "integer" }) }); const data = await res.json();

How it works

This random number generator uses the Web Crypto API (crypto.getRandomValues) for cryptographically secure randomness. It supports both integers and decimals within any range, and can generate multiple numbers at once.

All generation happens locally in your browser. No data is sent to a server. No cost, no signup, no tracking.

Need the same numbers from a script or an AI agent instead of the page? The same engine is exposed through the random-number API at api.clean.tools/v1/random_number, and you can run it as an MCP server by installing the @clean-tools/mcp package from npm.


Frequently asked questions

Are the minimum and maximum included in the results?

For integers, both ends are inclusive, so a range of 1 to 6 can return 1 or 6. For decimals the minimum can appear but the maximum is a boundary that is effectively never reached, the same way most random ranges exclude their upper limit.

Can the same number appear more than once when I generate several?

Yes. Each number in a batch is drawn independently, so duplicates are expected, especially across a small range. This tool does not draw unique values, so it is not a substitute for shuffling or picking without replacement.

What happens if I set the minimum higher than the maximum?

The tool swaps them automatically and updates both fields, so you still get a valid result instead of an error. Count is capped at 100 numbers and decimal places at 10.

Is this random enough for security uses like tokens or keys?

The generator uses the Web Crypto API (crypto.getRandomValues) with rejection sampling to avoid modulo bias, so values are unbiased and unpredictable. One caveat: integer ranges at or above 2^53 fall back to a 53-bit method that cannot reach every single value, though such ranges are far larger than typical use.

Can I use this from the command line or an AI agent?

Yes. Send a POST request to the REST endpoint at https://api.clean.tools/v1/random_number with your range as JSON and you get the numbers back as JSON. The same engine runs as an MCP server, so you can add it to Claude, Claude Code, or Cursor and let your agent call it directly. The @clean-tools/mcp npm package runs that server locally over stdio if you would rather not use the hosted endpoint.


More tools from Clean.tools

View all tools

Use Clean.tools from your AI agent

This tool is also random_number on the Clean.tools MCP server — the same engine, callable by your AI agent directly. No key, no signup: requests are processed in memory and request contents are never stored.

Claude Code
claude mcp add --scope user --transport http clean-tools https://mcp.clean.tools/mcp
Any MCP client (streamable HTTP, authless)
https://mcp.clean.tools/mcp

Every tool, the REST API, and setup for Cursor, Claude Desktop, VS Code & more →