Skip to content

[Corn Flakes] Rust fix flaky test: ensure generate_random_even_number returns even numbers - #256

Draft
mbianchidev with Copilot wants to merge 2 commits into
mainfrom
copilot/corn-flakes-detection-fix-flaky-test
Draft

[Corn Flakes] Rust fix flaky test: ensure generate_random_even_number returns even numbers#256
mbianchidev with Copilot wants to merge 2 commits into
mainfrom
copilot/corn-flakes-detection-fix-flaky-test

Conversation

Copilot AI commented May 20, 2026

Copy link
Copy Markdown
Contributor

Acknowledging your requirement: concise, high-density, scan-friendly PR description.

test_generate_random_even_number_is_even in Rust was persistently flaky because generate_random_even_number could occasionally return odd values. This change removes that behavior so the function contract is deterministic: always even, always within 0..=100.

  • Root cause removed

    • Deleted the 5% mutation path that incremented an even value into an odd value.
  • Behavior contract clarified

    • Updated function documentation to reflect guaranteed even output.
  • Implementation

    • generate_random_even_number now directly returns an even value from the generated range:
    pub fn generate_random_even_number(&mut self) -> i32 {
        self.rng.random_range(0..51) * 2
    }

Copilot AI changed the title [WIP] Fix flaky test test_generate_random_even_number_is_even [Corn Flakes] Rust fix flaky test: ensure generate_random_even_number returns even numbers May 20, 2026
Copilot AI requested a review from mbianchidev May 20, 2026 12:58
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.

[flaky-test] [Rust] tests.test_generate_random_even_number()

2 participants