Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix: seed srand on launch and fix spoiler log for seed testing generation #2902

Merged
merged 2 commits into from
May 20, 2023

Conversation

Archez
Copy link
Contributor

@Archez Archez commented May 20, 2023

This adds a call to srand() in launch flow so that the first call to rand() is unique. I figure placing this in OTRGlobals::InitOTR is sufficient for our needs (early enough in the app launch and in a visible place).

I also deferred random seed generation to pass in an empty string so the 3drando code can handle the rest of the logic for setting a random seed.

There is also a fix for the multi seed testing count logic to ensure we save the seed as a string, and hash it. This is to replicate the real flow so that the seed number tracked in the spoiler log is the same string you can enter in manually (string value pre-hashed).

Build Artifacts

@leggettc18
Copy link
Contributor

Looks fine to me, I assume you've tested to ensure that seeds generated in different launches and different builds generate different seeds?

@Archez
Copy link
Contributor Author

Archez commented May 20, 2023

Looks fine to me, I assume you've tested to ensure that seeds generated in different launches and different builds generate different seeds?

Waiting for the build result to download a release build and confirm. Will comment when my testing is done.

@Archez
Copy link
Contributor Author

Archez commented May 20, 2023

@leggettc18 Tested with the artifacts by having a minimal shipofharkinian.json that was set to skip title (to avoid any rand calls from the title screen). Multiple launches with the same json all successfully had unique generations.

@Archez Archez force-pushed the seed-srand-and-fixes branch from 911b0b9 to be0c976 Compare May 20, 2023 17:31
@leggettc18 leggettc18 merged commit cf42057 into HarbourMasters:develop-spock May 20, 2023
@Archez Archez deleted the seed-srand-and-fixes branch May 20, 2023 20:54
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