import { Injectable } from "@angular/core"; @Injectable({ providedIn: 'root' }) export class RandomService { private rollRandom(min: number, max: number): number { return Math.floor(Math.random() * (max - min) + min); } public matchesChance(chance: number, max: number): boolean { const random = this.rollRandom(0, max); console.log(random, chance); if (random < chance) { return true; } return false; } }