export function generateOtp(digits = 4): number {
  if (digits < 1) {
    throw new Error('OTP digits must be at least 1');
  }
  const min = Math.pow(10, digits - 1);
  const max = Math.pow(10, digits) - 1;
  const otp = Math.floor(Math.random() * (max - min + 1)) + min;
  return otp;
}
