export function splitAmounts(amount: number, playerCount: number, isTotal = true): number[] {
  if (playerCount < 1) {
    throw new Error('Mindestens ein Mitglied auswählen.');
  }

  const amountInCents = Math.round(amount * 100);
  if (!isTotal) {
    return Array.from({ length: playerCount }, () => amountInCents / 100);
  }

  const baseCents = Math.floor(amountInCents / playerCount);
  const remainderCents = amountInCents % playerCount;
  return Array.from(
    { length: playerCount },
    (_, index) => (baseCents + (index < remainderCents ? 1 : 0)) / 100,
  );
}
