Full typescript and mvvm implementation #3

Merged
Schmidii99 merged 26 commits from Developer into main 2023-04-23 20:02:32 +02:00
Showing only changes of commit b978835251 - Show all commits

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
} }
} }