MCP Servers/Random Number Generator

Random Number Generator

utilities

active

Generate cryptographically secure random numbers with customizable ranges, types, and distributions

randomgeneratorutilitiescryptographicdicestatisticssimulationtesting

API Access Requires Subscription

While you can view all details here, using this MCP server's API requires a Enterprise subscription. API calls with FREE plan keys will return an access error.

View Pricing Plans

Available Tools

flip_coin

tool

Simulate coin flips with cryptographic randomness.

generate_random_boolean

tool

Generate cryptographically secure random boolean values.

generate_random_decimal

tool

Generate cryptographically secure random decimal numbers with configurable precision.

generate_random_integer

tool

Generate cryptographically secure random integers within a specified range. Supports unique values, sorting, and multiple statistical distributions.

generate_random_sequence

tool

Generate a sequence of numbers with optional shuffling.

roll_dice

tool

Simulate rolling dice with customizable sides and count.

Documentation

Integration Guide

MCP Client Setup

Add the Random Number Generator MCP server to your MCP client configuration:

{
  "mcpServers": {
    "random-number-generator": {
      "command": "curl",
      "args": [
        "-X", "POST",
        "https://apistack.online/api/mcp/utilities/random-number-generator/sse",
        "-H", "Content-Type: application/json",
        "-H", "Authorization: Bearer YOUR_API_KEY",
        "--data-raw", "@-"
      ],
      "transport": "sse"
    }
  }
}

Replace YOUR_API_KEY with your APIStack API key from the Dashboard.

Usage Examples

Example 1: Generate Random Integers

// Generate 10 unique random integers between 1 and 100
const result = await mcpClient.callTool('generate_random_integer', {
  min: 1,
  max: 100,
  count: 10,
  unique: true,
  sorted: true,
  includeStatistics: true
});

Example 2: Roll Dice

// Roll 3 twenty-sided dice (D20) 5 times
const result = await mcpClient.callTool('roll_dice', {
  sides: 20,
  diceCount: 3,
  count: 5,
  includeStatistics: true
});

Example 3: Generate Random Decimals

// Generate 5 random decimals with 4 decimal places
const result = await mcpClient.callTool('generate_random_decimal', {
  min: 0,
  max: 1,
  count: 5,
  decimalPlaces: 4,
  distribution: 'normal'
});

Example 4: Flip Coins

// Flip 100 coins and get statistics
const result = await mcpClient.callTool('flip_coin', {
  count: 100,
  includeStatistics: true
});

Code Examples

Code Examples

JavaScript Example

// Random Number Generator MCP Client Example
const response = await fetch('https://apistack.online/api/mcp/utilities/random-number-generator/sse', {
    method: 'POST',
    headers: {
        'Content-Type': 'application/json',
        'Authorization': 'Bearer YOUR_API_KEY'
    },
    body: JSON.stringify({
        jsonrpc: '2.0',
        id: 'req-1',
        method: 'tools/call',
        params: {
            name: 'generate_random_integer',
            arguments: {
                min: 1,
                max: 100,
                count: 10,
                unique: true,
                includeStatistics: true
            }
        }
    })
});

const result = await response.json();
console.log(result);

Python Example

# Random Number Generator MCP Client Example
import requests

response = requests.post(
    'https://apistack.online/api/mcp/utilities/random-number-generator/sse',
    headers={
        'Content-Type': 'application/json',
        'Authorization': 'Bearer YOUR_API_KEY'
    },
    json={
        'jsonrpc': '2.0',
        'id': 'req-1',
        'method': 'tools/call',
        'params': {
            'name': 'roll_dice',
            'arguments': {
                'sides': 6,
                'diceCount': 2,
                'count': 10,
                'includeStatistics': True
            }
        }
    }
)

result = response.json()
print(result)

cURL Example

# Random Number Generator MCP Client Example
curl -X POST https://apistack.online/api/mcp/utilities/random-number-generator/sse \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -d '{
    "jsonrpc": "2.0",
    "id": "req-1",
    "method": "tools/call",
    "params": {
        "name": "flip_coin",
        "arguments": {
            "count": 50,
            "includeStatistics": true
        }
    }
}'

Advanced Example: Normal Distribution

// Generate random decimals with normal distribution
const response = await fetch('https://apistack.online/api/mcp/utilities/random-number-generator/sse', {
    method: 'POST',
    headers: {
        'Content-Type': 'application/json',
        'Authorization': 'Bearer YOUR_API_KEY'
    },
    body: JSON.stringify({
        jsonrpc: '2.0',
        id: 'req-2',
        method: 'tools/call',
        params: {
            name: 'generate_random_decimal',
            arguments: {
                min: 0,
                max: 100,
                count: 1000,
                decimalPlaces: 2,
                distribution: 'normal',
                includeStatistics: true
            }
        }
    })
});

const result = await response.json();
console.log(result);

Quick Info

Endpoint
/api/mcp/utilities/random-number-generator/sse
Transport
Server-Sent Events (SSE)
Tools Available
6
Plan Required
PRO, ENTERPRISE

MCP Configuration

Add this configuration to your MCP client:

Note: Replace "YOUR_API_KEY" with a valid Enterprise API key. FREE plan keys will receive access errors.

{
  "mcpServers": {
    "random-number-generator-utilities": {
      "command": "curl",
      "args": [
        "-X",
        "POST",
        "https://apistack.online/api/mcp/utilities/random-number-generator/sse",
        "-H",
        "Content-Type: application/json",
        "-H",
        "Authorization: Bearer YOUR_API_KEY",
        "--data-raw",
        "@-"
      ],
      "transport": "sse"
    }
  }
}

Try It Out

Use the MCP configuration above in your AI client, or test the underlying APIs in our playground.

API playground requires a Enterprise subscription for access.

Open in Playground