Some minor changes to solve the bug. Going to change Math.Random with Random.nextInt()