From 13f52c8dd38286128aa08a9395ecead9ca41e435 Mon Sep 17 00:00:00 2001 From: Shiroi Kitsu <108461408+shiroikitsu8@users.noreply.github.com> Date: Tue, 3 Jan 2023 21:22:12 +0700 Subject: [PATCH] fix ghost list randomizing --- src/modules/ghost.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/modules/ghost.ts b/src/modules/ghost.ts index 3246504..928650c 100644 --- a/src/modules/ghost.ts +++ b/src/modules/ghost.ts @@ -358,7 +358,8 @@ export default class GhostModule extends Module { while(arr.length < maxNumber) { // Pick random car Id - let randomNumber = MersenneTwister.int(0, maxNumber-1); + let randomNumber = MersenneTwister.int(0, car.length-1); + if(arr.indexOf(randomNumber) === -1) { // Push current number to array