mirror of
https://github.com/openfrontio/OpenFrontIO.git
synced 2026-07-17 12:59:34 +00:00
Public lobbies map will now be picked from a randomized playlist, assuring each map is played at least once, without duplicates.
This commit is contained in:
@@ -47,4 +47,13 @@ export class PseudoRandom {
|
||||
chance(odds: number): boolean {
|
||||
return this.nextInt(0, odds) == 0;
|
||||
}
|
||||
|
||||
shuffleArray(array: any[]) {
|
||||
for (let i = array.length - 1; i >= 0; i--) {
|
||||
const j = Math.floor(Math.random() * (i + 1));
|
||||
[array[i], array[j]] = [array[j], array[i]];
|
||||
}
|
||||
|
||||
return array;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user