
export class SharedFunctions {
  static openMail(event?: Event) {
    event?.preventDefault();
    const user = 'andreas.dahm';
    const domain = 'gmail.com';
    globalThis.location.href = `mailto:${user}@${domain}`;
  }

  static randomIntFromInterval(min: number, max: number): number {
    return Math.floor(Math.random() * (max - min + 1) + min);
  }

  static randomEventIntFromInterval(interval: number): number {
    return Math.floor(Math.random() * (interval / 2)) * 2;
  }

  static shuffleArray<T>(array: T[]): T[] {
    for (let i = array.length - 1; i > 0; i--) {
      const j = Math.floor(Math.random() * (i + 1));
      [array[i], array[j]] = [array[j], array[i]];
    }
    return array;
  }
}
