Skip to content

Address PR feedback on Random.NextXx - #127849

Merged
stephentoub merged 4 commits into
mainfrom
stoub/addressrandfeedback
Jul 14, 2026
Merged

stephentoub merged 4 commits into
mainfrom
stoub/addressrandfeedback

Conversation

@stephentoub

Copy link
Copy Markdown
Member

Somehow the extra commit didn't get into the PR before it merged.

cc: @tannergooding

@dotnet-policy-service

Copy link
Copy Markdown
Contributor

Tagging subscribers to this area: @dotnet/area-system-numerics
See info in area-owners.md if you want to be subscribed.

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 updates System.Random’s new generic integer APIs (NextInteger<T>) to address post-merge feedback, primarily around documenting/enforcing assumptions for supported IBinaryInteger<T> implementations and simplifying the full-range generation path.

Changes:

  • Updates NextInteger<T> type requirements in XML docs (two’s-complement/full-range wording).
  • Adjusts NextInteger<T>() to validate T.MaxValue sign and simplifies generation (removes rejection loop).
  • Refactors range generation logic (ternary simplification) and folds the generic rejection-sampling helper into NextBinaryIntegerInRange.
Show a summary per file
File Description
src/libraries/System.Private.CoreLib/src/System/Random.cs Tweaks docs/validation and refactors generic integer random generation logic for NextInteger<T> and helpers.

Copilot's findings

  • Files reviewed: 1/1 changed files
  • Comments generated: 3

Copilot AI review requested due to automatic review settings July 13, 2026 01:15
@stephentoub
stephentoub temporarily deployed to copilot-pat-pool July 13, 2026 01:15 — with GitHub Actions Inactive
@stephentoub

Copy link
Copy Markdown
Member Author

@copilot please address all of the pending feedback

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.

Copilot's findings

  • Files reviewed: 1/1 changed files
  • Comments generated: 2

Copilot AI review requested due to automatic review settings July 13, 2026 01:42
@stephentoub
stephentoub removed the request for review from Copilot July 13, 2026 01:42
Copilot AI review requested due to automatic review settings July 13, 2026 01:43
@stephentoub
stephentoub removed the request for review from Copilot July 13, 2026 01:43

Copilot AI commented Jul 13, 2026

Copy link
Copy Markdown
Contributor

@copilot please address all of the pending feedback

Addressed in 2402d1e6e, with a follow-up clarification in 3c9fc25f9.

@stephentoub
stephentoub enabled auto-merge (squash) July 13, 2026 01:52
@stephentoub
stephentoub disabled auto-merge July 13, 2026 01:52
@stephentoub
stephentoub enabled auto-merge (squash) July 13, 2026 01:52
Copilot AI temporarily deployed to copilot-pat-pool July 13, 2026 01:52 Inactive
Copilot AI temporarily deployed to copilot-pat-pool July 13, 2026 01:52 Inactive
@stephentoub
stephentoub merged commit cd8f850 into main Jul 14, 2026
145 checks passed
@stephentoub
stephentoub deleted the stoub/addressrandfeedback branch July 14, 2026 19:47
@dotnet-milestone-bot dotnet-milestone-bot Bot added this to the 11.0-preview7 milestone Jul 15, 2026
@github-actions github-actions Bot locked and limited conversation to collaborators Aug 15, 2026

This branch was previously deployed

1 inactive deployment
copilot-pat-pool — 3c9fc25f Deployed Jul 13, 2026 by Copilot via pat_pool #14652
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants