make method private

This commit is contained in:
Florian Schmid 2023-04-19 22:06:05 +02:00
parent 2350b9126c
commit b978835251

View File

@ -21,15 +21,14 @@ export class CpuRepository {
} }
getRandomCpu() { getRandomCpu() {
let randomIndex = this.getRandomInt(0, this.#cpuList.length); let randomIndex = this.#getRandomInt(0, this.#cpuList.length);
this.#cpuList[randomIndex]["name"] = this.#cpuList[randomIndex]["name"].split('@')[0]; this.#cpuList[randomIndex]["name"] = this.#cpuList[randomIndex]["name"].split('@')[0];
return this.#cpuList[randomIndex]; return this.#cpuList[randomIndex];
} }
getRandomInt(min, max) { #getRandomInt(min, max) {
min = Math.ceil(min); min = Math.ceil(min);
max = Math.floor(max); max = Math.floor(max);
return Math.floor(Math.random() * (max - min) + min); // The maximum is exclusive and the minimum is inclusive return Math.floor(Math.random() * (max - min) + min); // The maximum is exclusive and the minimum is inclusive
} }
} }