Landing: 99266eead94c
Project / Subsystem
gcc / libstdc++
Date
2026-07-27
Author
Tomasz Kamiński
Commit
99266eead94c8aca7faa1e06d886c2f4abdbb1ed
Source
github
Perf win
No
Breaking
No
All attributes
- project
- gcc
- subsystem
- libstdc++
- patch_id
- —
- commit_hash
- 99266eead94c8aca7faa1e06d886c2f4abdbb1ed
- source_type
- github
- headline
- Handle generators with non-zero min in uniform_int_distribution
- tldr
- Fixed `uniform_int_distribution` to correctly handle random number generators whose range does not start at zero.
- author
- Tomasz Kamiński
- outcome
- committed
- performance_win
- false
- breaking_change
- false
- series_id
- —
- series_parts
- []
- tags
-
- • libstdc++
- • random numbers
- discussion_id_link
- —
- bugzilla_pr
- —
- date
- 2026-07-27T00:00:00.000Z
The Lemire’s algorithm used in uniform_int_distribution incorrectly assumed that random number generators (engines) always produced values starting from zero. This commit corrects this assumption by subtracting the minimum value of the generator’s range before producing output. This ensures uniformity for user-provided engines whose ranges are offset, resolving a failure in testDiscreteDist.