Generator Utilities

Random Float

Generate cryptographically secure random floating-point numbers via GET /v1/generate/random/float. Specify count, min/max bounds, and decimal precision. Returns array like [0.7234, 1.8901] for simulations, testing, or seeding algorithms. Available through MCP in Cursor and Windsurf, plus REST API for reliable randomness without language-specific quirks.

API Endpoint

GET /v1/generate/random/float

Code Examples

curl "https://tinyfn.io/v1/generate/random/float" \
  -H "X-API-Key: YOUR_API_KEY"
const response = await fetch('https://tinyfn.io/v1/generate/random/float', {
  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/float',
    headers={'X-API-Key': 'YOUR_API_KEY'})
data = response.json()
print(data)

Use via MCP

Add to your AI agent

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"
      }
    }
  }
}

Learn more about MCP setup →

FAQ

How do I generate multiple random floats with specific bounds?

Use count parameter with min/max bounds: GET /v1/generate/random/float?count=5&min=1.0&max=10.0 returns 5 floats between 1.0 and 10.0.

Can I control decimal precision of generated floats?

Yes, use the precision parameter to specify decimal places. precision=2 gives values like 3.14, precision=4 gives 3.1416.

Is this cryptographically secure random generation?

Yes, uses cryptographically secure random number generation, making it suitable for security applications, not just simulations.

How does MCP integration work for random floats in AI coding assistants?

AI agents can call the random float generator directly through MCP in tools like Cursor or Claude Code, getting real random values instead of placeholder examples.

What's the difference between this and Math.random() in JavaScript?

This provides cryptographically secure randomness with configurable precision and bounds, while Math.random() uses pseudo-random generation with limited control.

Try Random Float Now

Get your free API key and start using Random Float in seconds.

Get Free API Key