simulateHandOutcomeAsync
simulateHandOutcomeAsync(holeCards: CardInput, board: CardInput, numSimulations: number, seed: number, villains?: number, options?: AsyncOptions): Promise<number>
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
Same as simulateHandOutcome, but the work runs on the libuv thread pool so your event loop stays responsive—HTTP servers, Electron, and batch UIs.
Pass optional AsyncOptions to cancel long runs via AbortSignal.
How to use
const poker = require('poker-calculations');
const equity = await poker.simulateHandOutcomeAsync(['Ah', 'Kh'], ['Qh', 'Jh', '2c'], 8000, 42, 1);
const ac = new AbortController();
const pending = poker.simulateHandOutcomeAsync(
['Ah', 'Kh'],
['Qh', 'Jh', '2c'],
500_000,
42,
1,
{ signal: ac.signal },
);
// ac.abort(); // Promise rejects with AbortError
See also
simulateHandOutcome · Monte Carlo equity guide · AsyncOptions