Generates cryptographically secure random integers within specified ranges via GET /v1/generate/random/number. Perfect for AI agents needing unpredictable values for testing, simulations, or game mechanics. Returns single integers or arrays, with customizable min/max bounds. Uses secure random number generation, not pseudo-random algorithms.
curl "https://tinyfn.io/v1/generate/random/number" \
-H "X-API-Key: YOUR_API_KEY"
const response = await fetch('https://tinyfn.io/v1/generate/random/number', {
headers: { 'X-API-Key': 'YOUR_API_KEY' }
});
const data = await response.json();
console.log(data);
import requests
response = requests.get('https://tinyfn.io/v1/generate/random/number',
headers={'X-API-Key': 'YOUR_API_KEY'})
data = response.json()
print(data)
Connect your AI agent (Claude, Cursor, Windsurf, etc.) to TinyFn's generator tools:
{
"mcpServers": {
"tinyfn-generator": {
"url": "https://tinyfn.io/mcp/generator",
"headers": {
"X-API-Key": "YOUR_API_KEY"
}
}
}
}
Use GET /v1/generate/random/number?min=1&max=100. The endpoint returns a single integer within the inclusive range.
Yes, add a count parameter like ?count=5 to get an array of random numbers. Useful for batch operations in MCP tools.
TinyFn uses cryptographically secure random generation, while Math.random() is pseudo-random and predictable. This tool provides true randomness for security-sensitive applications.
Default range is typically 0 to 100, but check the API documentation for exact defaults. Always specify ranges for predictable behavior.
Through MCP, Claude Code can call this tool to generate random user IDs, test scores, or sample data sets for database seeding and unit tests.
Get your free API key and start using Random Number in seconds.
Get Free API Key