import type { TarotCard } from './cards'; export type Pick = { card: TarotCard; position: string; reversed: boolean }; export function fisherYates(input: T[]): T[] { const a = [...input]; for (let i = a.length - 1; i > 0; i -= 1) { const j = Math.floor(Math.random() * (i + 1)); [a[i], a[j]] = [a[j], a[i]]; } return a; } export function buildShuffle(deck: TarotCard[], size: number): (TarotCard & { reversed: boolean })[] { return fisherYates(deck) .slice(0, size) .map((c) => ({ ...c, reversed: Math.random() < 0.5 })); }