change RNG except shuffle in duel to std::mt19937#2826
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull Request Overview
This PR replaces the project’s custom RNG implementation with C++’s std::mt19937 and standard distribution APIs.
- Switches includes and types from custom mt19937 to std::mt19937 and adds uniform distributions.
- Seeds engines using std::random_device or std::seed_seq instead of time-based resets.
- Updates random integer, real value, and shuffle calls to use std::uniform_* and std::shuffle.
Reviewed Changes
Copilot reviewed 9 out of 9 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| gframe/sound_manager.h | Replaced custom RNG include and declared std::mt19937 |
| gframe/sound_manager.cpp | Seeded rng with std::random_device; replaced get_random_integer |
| gframe/replay_mode.cpp | Swapped custom RNG include for <random> |
| gframe/duelclient.h | Changed RNG type to std::mt19937 and added uniform_real_distribution |
| gframe/duelclient.cpp | Seeded rng with std::random_device; replaced RNG calls with std distributions |
| gframe/deck_con.h | Updated RNG type and declared DeckBuilder constructor |
| gframe/deck_con.cpp | Implemented DeckBuilder seeding; replaced custom shuffle_vector |
| gframe/client_field.h | Replaced custom RNG with std::mt19937 |
| gframe/client_field.cpp | Seeded rng with std::random_device; replaced shuffle_vector |
Comments suppressed due to low confidence (2)
gframe/duelclient.h:30
- [nitpick] Add a comment to real_dist to clarify that it generates values in [0,1) and that its parameters are fixed, improving readability for future maintainers.
static std::uniform_real_distribution<float> real_dist;
gframe/replay_mode.cpp:5
- It looks like is now included but not used in this file; consider removing the unused include to reduce unnecessary dependencies.
#include <random>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
move non-essential part to this PR
@mercury233
@purerosefallen
@Wind2009-Louse
@fallenstardust