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.
22 lines (21 loc) • 917 B
TypeScript
import { RandomNumberGenerator } from '../../../ports/index.js';
/**
* Default implementation of the RandomNumberGenerator interface.
* Uses JavaScript's Math.random() for generating random numbers.
*/
export declare class DefaultRandomNumberGenerator implements RandomNumberGenerator {
/**
* Generates a 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.
* @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;
}