Skip to content

feat: implement random_number exercise - #500

Open
andreafazzina wants to merge 3 commits into
UNICT-Quality-Development:mainfrom
andreafazzina:random_number.cpp
Open

andreafazzina wants to merge 3 commits into
UNICT-Quality-Development:mainfrom
andreafazzina:random_number.cpp

Conversation

@andreafazzina

@andreafazzina andreafazzina commented Nov 11, 2026 •

Copy link
Copy Markdown

Summary by CodeRabbit

  • New Features
    • Added an exercise that displays a randomly selected whole number from 1 through 10, inclusive. The value can vary each time the exercise runs, and the displayed result always falls within that range. This gives users a simple, visible example of a randomly generated number in the program’s output.

@coderabbitai

coderabbitai Bot commented Nov 11, 2026 •

Copy link
Copy Markdown

Explain Change →

No actionable comments were generated in the recent review.

Walkthrough

The change adds func_random, which returns a uniformly distributed integer from 1 through 10. The main function seeds an mt19937 generator, prints the result, and returns EXIT_SUCCESS.

Changes: Random number generation

Layer / File(s) Summary
Generate and print a random integer
exercises/random_number.cpp
func_random generates an integer from 1 through 10 using the supplied generator. main seeds the generator with random_device, prints the result, and returns EXIT_SUCCESS.

Estimated code review effort: 2 (Simple) | ~7 minutes

Change: Feature

Suggested reviewers: helias

Merge Risk: Minimal · up to ca154

This adds a small standalone program that prints a random integer from 1 through 10. No actionable merge risk was identified.

Pre-merge checks: Passed 4

Check name Status Explanation
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check Passed The title "feat: implement random_number exercise" matches the changeset. The PR adds exercises/random_number.cpp, a program that seeds an mt19937 generator, draws a uniform integer from 1 to 10, prin…
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Full details: Title check

Explanation

The title "feat: implement random_number exercise" matches the changeset. The PR adds exercises/random_number.cpp, a program that seeds an mt19937 generator, draws a uniform integer from 1 to 10, prints it, and returns EXIT_SUCCESS. The title names the main change and the file's purpose. It uses a conventional commit prefix and is short, specific, and clear.

Finishing Touches

Generate unit tests (beta)

  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

Recent review info

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 1c97c8d3-aff3-4bc5-a150-249b0920bf38
Commits

Reviewing files that changed from the base of the PR and between dfd2a08 and ca1541b.

Files selected for processing: 1

  • exercises/random_number.cpp
Files with no reviewable changes: 1

  • exercises/random_number.cpp

Included review availability: This review used your included allowance. Your plan provides up to 1 included review per hour; 0 remain after this review.

@andreafazzina andreafazzina changed the title feet: implement random_number exercise feat: implement random_number exercise Nov 11, 2026
Comment thread exercises/random_number.cpp Resolved
Comment thread exercises/random_number.cpp Resolved
Comment thread exercises/random_number.cpp Resolved
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