Skip to main content
Deno 2 is finally here 🎉️
Learn more
Module

x/fortuna/mod.ts>unbiasedCoin

A TypeScript module for random events and gacha.
Latest
function unbiasedCoin
import { unbiasedCoin } from "https://deno.land/x/fortuna@v4.1.4/mod.ts";

Toss n unbiased coins (50% chance of head / tail). A biased coin can be implemented using GachaMachine. Do not toss more than 62 coins at once.

Parameters

optional
n = [UNSUPPORTED]

Number of coins to toss.

Returns

("H" | "T")[]

Array of results. Returns "H" for head and "T" for tail.