Skip to content

Public lobbies map will now be picked from a randomized playlist, assuring each map is played at least once, without duplicates. - #39

Merged
evanpelle merged 2 commits into
openfrontio:mainfrom
NewHappyRabbit:map-randomizer
Feb 18, 2025
Merged

evanpelle merged 2 commits into
openfrontio:mainfrom
NewHappyRabbit:map-randomizer

Conversation

@NewHappyRabbit

Copy link
Copy Markdown
Contributor

No description provided.

…uring each map is played at least once, without duplicates.
Comment thread src/core/PseudoRandom.ts Outdated

shuffleArray(array: any[]) {
for (let i = array.length - 1; i >= 0; i--) {
const j = Math.floor(Math.random() * (i + 1));

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Instead of Math.random(), can you do this.nextInt(0, i+1)

Want to ensure that everything in the file is deterministic or clients can get out of sync.
(in this case it doesn't matter since the server is calling it, just worried we'll accidently call it in the client)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants