UNPKG

random-tables-mcp

Version:

An MCP (Model Context Protocol) server for managing and rolling on random-table assets used in tabletop RPGs. Create, update, and roll on random tables with support for nested tables, weighted entries, and range-based results.

23 lines (22 loc) 1.01 kB
import { RandomNumberGenerator } from '../../../ports/index.js'; /** * Implementation of the RandomNumberGenerator interface using Node's crypto module. * Provides cryptographically secure random numbers. */ export declare class CryptoRandomNumberGenerator implements RandomNumberGenerator { /** * Generates a cryptographically secure random number between min and max (inclusive). * @param min The minimum value (inclusive). * @param max The maximum value (inclusive). * @returns A random number between min and max. */ getRandomNumber(min: number, max: number): number; /** * Gets a weighted random index based on the provided weights using * cryptographically secure random number generation. * @param weights An array of weights. * @returns A random index, with probability proportional to the weights. * @throws Error if the weights array is empty or contains non-positive values. */ getWeightedIndex(weights: number[]): number; }