Skip to main content

parallelHandSimulation

Same with worker threads and distinct seeds per chunk.

parallelHandSimulation(holeCards: CardInput, board: CardInput, numSimulations: number, baseSeed: number, villains: number, numThreads: number): number

CardInput is string[] or Uint8Array of deck ids 0..51. See Card notation.

Import

const poker = require('poker-calculations');

ESM (Node):

import { createRequire } from 'module';
const require = createRequire(import.meta.url);
const poker = require('poker-calculations');

When to use

Use on multi-core servers when simulateHandOutcome is CPU-bound and you want the same MC model with higher throughput. Each thread advances baseSeed so chunks stay independent.

How to use

const poker = require('poker-calculations');

const equity = poker.parallelHandSimulation(
['As', 'Ks'],
[],
200_000,
9001,
1,
4,
);
console.log(equity.toFixed(4));

Board length may be 0–5; known cards must not overlap between hero and board.

See also

simulateHandOutcome · exactHuEquityVsRandomHand