tarot-mcp-server
Version:
Model Context Protocol server for Rider-Waite tarot card readings
13 lines (12 loc) • 519 B
JavaScript
/**
* Generate a cryptographically secure random number between 0 and 1.
* @throws {Error} If crypto.getRandomValues is not available.
*/
export function getSecureRandom() {
if (typeof crypto !== 'undefined' && typeof crypto.getRandomValues === 'function') {
const array = new Uint32Array(1);
crypto.getRandomValues(array);
return array[0] / (0xffffffff + 1);
}
throw new Error('A secure random number generator (crypto.getRandomValues) is not available in this environment.');
}