GETPOST

RANDOM NUMBERS API

Generate random numbers with customizable range and count. Perfect for applications that need random data generation, testing, or random selection functionality.

SERVER

tools64.com

PLATFORM

Functions

VERSION

v1.0.0

BASE URL

https://tools64.com/api/random

GET Method

Generate random numbers using query parameters. Simple and efficient for basic use cases.

Request Parameters

min

number

Minimum value (default: 1)

max

number

Maximum value (default: 100)

count

number

Number of values (default: 1, max: 1000)

Response

Type: JSON

Returns an array of random numbers with metadata

Code Examples

# Using curl
curl "https://tools64.com/api/random?min=1&max=100&count=5"

# Using Python requests
import requests

# Generate multiple random numbers
response = requests.get('https://tools64.com/api/random', params={
    'min': 1,
    'max': 1000,
    'count': 10
})
data = response.json()
random_numbers = data['data']['numbers']

POST Method

Generate random numbers using a JSON request body. This method is better for applications that need to send complex parameters.

Request Parameters

min

number

Minimum value (default: 1)

max

number

Maximum value (default: 100)

count

number

Number of values (default: 1, max: 1000)

Request Body

{
  "min": 1,
  "max": 1000,
  "count": 10
}

Response

Type: JSON

Returns an array of random numbers with metadata

Code Examples

# Using curl
curl -X POST "https://tools64.com/api/random" \
  -H "Content-Type: application/json" \
  -d '{
    "min": 1,
    "max": 1000,
    "count": 10
  }'

# Using Python requests
import requests
import json

# Generate multiple random numbers
payload = {
    "min": 1,
    "max": 1000,
    "count": 10
}

response = requests.post(
    'https://tools64.com/api/random',
    json=payload,
    headers={'Content-Type': 'application/json'}
)

data = response.json()
random_numbers = data['data']['numbers']

ENDPOINT EXAMPLES

Basic Usage

GET /api/random

Returns a random number between 1 and 100

Custom Range

GET /api/random?min=10&max=50

Returns a random number between 10 and 50

Multiple Numbers

GET /api/random?min=1&max=1000&count=5

Returns 5 random numbers between 1 and 1000

ERROR HANDLING

The API returns appropriate HTTP status codes and error messages for various scenarios.

400 Bad Request

{
  "error": "Min value cannot be greater than max value"
}

500 Internal Server Error

{
  "error": "Internal server error",
  "message": "Error details"
}

RATE LIMITS & USAGE

Rate Limits

10 requests per hour per IP

Best Practices

  • Use GET for simple requests
  • Use POST for complex parameter sets
  • Implement proper error handling
  • Cache results when appropriate

Use Cases

  • Generating random numbers for games and simulations
  • Creating test data for development
  • Random sampling for statistical analysis
  • Generating unique identifiers
  • Creating random sequences for cryptography

READY TO TEST THE API?

Try out the Random Numbers API with different parameters to see it in action.