Skip to content

change RNG except shuffle in duel to std::mt19937#2826

Merged
salix5 merged 9 commits into
Fluorohydride:patch-std-mt19937from
salix5:patch-std-mt19937
Jun 7, 2025
Merged

change RNG except shuffle in duel to std::mt19937#2826
salix5 merged 9 commits into
Fluorohydride:patch-std-mt19937from
salix5:patch-std-mt19937

Conversation

@salix5

@salix5 salix5 commented Jun 7, 2025

Copy link
Copy Markdown
Collaborator

move non-essential part to this PR

@mercury233
@purerosefallen
@Wind2009-Louse
@fallenstardust

@salix5 salix5 requested a review from Copilot June 7, 2025 04:03

This comment was marked as outdated.

@salix5 salix5 requested a review from Copilot June 7, 2025 12:54

This comment was marked as outdated.

@salix5 salix5 requested a review from Copilot June 7, 2025 13:11

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

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>

Comment thread gframe/sound_manager.cpp
Comment thread gframe/duelclient.cpp
@salix5 salix5 changed the base branch from master to patch-std-mt19937 June 7, 2025 13:18
@salix5 salix5 merged commit a50beb6 into Fluorohydride:patch-std-mt19937 Jun 7, 2025
8 checks passed
@salix5 salix5 deleted the patch-std-mt19937 branch June 7, 2025 13:19
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