Skip to content

Commit

Permalink
fix: removed invalid null as value from Random.shuffle() (#3095)
Browse files Browse the repository at this point in the history
Setting `null` on a variable of type `T` isn't valid in the eyes of TS
  • Loading branch information
Autsider666 authored Jun 11, 2024
1 parent c76d4fe commit 3b6bd7d
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/engine/Math/Random.ts
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,7 @@ export class Random {
*/
public shuffle<T>(array: Array<T>): Array<T> {
const tempArray = array.slice(0);
let swap: T = null;
let swap: T;
for (let i = 0; i < tempArray.length - 2; i++) {
const randomIndex = this.integer(i, tempArray.length - 1);
swap = tempArray[i];
Expand Down

0 comments on commit 3b6bd7d

Please sign in to comment.