Skip to content

fix: correct FCFS template handling and improve self-tests#3193

Open
harshitrajput2802 wants to merge 2 commits into
TheAlgorithms:masterfrom
harshitrajput2802:fix-fcfs-bug
Open

fix: correct FCFS template handling and improve self-tests#3193
harshitrajput2802 wants to merge 2 commits into
TheAlgorithms:masterfrom
harshitrajput2802:fix-fcfs-bug

Conversation

@harshitrajput2802

@harshitrajput2802 harshitrajput2802 commented Jul 4, 2026

Copy link
Copy Markdown

Description of Change

Corrected the FCFS scheduling implementation by fixing a template type mismatch in the reference implementation used for verification. The previous implementation hardcoded the input type to uint32_t, preventing the helper function from correctly supporting arbitrary template parameters.

This update also:

  • Fixed the template signature of the reference implementation to properly use the class template parameters.
  • Replaced repeated std::srand(std::time(nullptr)) calls with a single std::mt19937 engine and uniform distributions for reliable randomized testing.
  • Added namespace organization under scheduling::fcfs.
  • Improved const-correctness and documentation with Doxygen comments.
  • Preserved the existing FCFS scheduling behavior while strengthening correctness and maintainability.

Checklist

  • Added description of change
  • Added file name matches File name guidelines
  • Added tests and example, test must pass
  • Added documentation so that the program is self-explanatory and educational
  • Relevant documentation/comments is changed or added
  • PR title follows semantic commit guidelines
  • Search previous suggestions before making a new one, as yours may be a duplicate.
  • I acknowledge that all my contributions will be made under the project's license.

Notes: Fixes the FCFS reference implementation to correctly support template parameters and improves randomized self-tests using a modern C++ random number generator.

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.

1 participant