confirmation.ts

601 B · raw

1/** Pick 3 distinct positions in [1, 12] for the recovery-words confirmation2 * gate. Sorted ascending so they read naturally in the prompt. */3export function pickConfirmationPositions(): [number, number, number] {4  const positions = Array.from({ length: 12 }, (_, i) => i + 1);5  for (let i = positions.length - 1; i > 0; i--) {6    const j = Math.floor(Math.random() * (i + 1));7    [positions[i], positions[j]] = [positions[j]!, positions[i]!];8  }9  const picked = [positions[0]!, positions[1]!, positions[2]!] as const;10  return [...picked].sort((a, b) => a - b) as [number, number, number];11}