Random Number

Random Number

Provides LLMs with essential random generation abilities, built entirely on Python's standard library.

43
Stars
5
Forks
2
Releases

Overview

Random Number MCP provides a compact suite of random-number utilities drawn from Python's standard library. It exposes both fast, non-cryptographic operations and cryptographically secure alternatives, enabling LLMs to generate numbers, select or shuffle items, and create tokens in deterministic workflows while keeping cryptographic security where needed. The server implements these functions as named tools: random_int (generate a random integer), random_float (generate a random float), random_choices (select k items with optional weights), random_shuffle (return a shuffled copy), random_sample (select k unique items without replacement), secure_token_hex (cryptographically secure hex tokens), and secure_random_int (cryptographically secure integers below an upper bound). Each tool maps to the corresponding Python stdlib function (random.randint, random.uniform, random.choices, random.sample, secrets.token_hex, secrets.randbelow). The package distinguishes between standard and secure functions: standard for simulations and general use; secure for tokens and keys. It is designed for developers and testers integrating RNG capabilities into MCP-driven workflows, with setup guidance and MCP client configuration examples included.

Details

Owner
zazencodes
Language
Python
License
MIT License
Updated
2025-12-07

Features

random_int

Generate a random integer between low and high (inclusive) using random.randint().

random_float

Generate a random float between low and high using random.uniform().

random_choices

Choose k items from a population with optional weights using random.choices().

random_shuffle

Return a new list with items shuffled using random.sample().

random_sample

Choose k unique items from a population without replacement using random.sample().

secure_token_hex

Generate a cryptographically secure hex token using secrets.token_hex().

secure_random_int

Generate a cryptographically secure random integer below an upper bound using secrets.randbelow().

Tags

randomnumberscryptographysecretsstdlibutilitiesmcprandom-number