Landing: 675b6856ca66
Project / Subsystem
gcc / libstdc++
Date
2026-07-28
Author
Tomasz Kamiński
Commit
675b6856ca66366632598cb0f5ccedbb337ccc0b
Source
github
Perf win
No
Breaking
No
All attributes
- project
- gcc
- subsystem
- libstdc++
- patch_id
- —
- commit_hash
- 675b6856ca66366632598cb0f5ccedbb337ccc0b
- source_type
- github
- headline
- libstdc++: Lemire's algorithm adapted for non--bit ranges.
- tldr
- Random number generation in libstdc++ uses Lemire's algorithm more broadly for power-of-two ranges, improving portability.
- author
- Tomasz Kamiński
- outcome
- committed
- performance_win
- false
- breaking_change
- false
- series_id
- —
- series_parts
- []
- tags
-
- • libstdc++
- • random
- • portability
- discussion_id_link
- —
- bugzilla_pr
- —
- date
- 2026-07-28T00:00:00.000Z
GCC’s libstdc++ now more broadly applies Lemire’s algorithm for generating random numbers within power-of-two ranges. Previously, this efficient algorithm was primarily used for 32-bit (__UINT32_TYPE__) and 64-bit (__UINT64_TYPE__) unsigned integers. This update allows it to work with targets that lack these specific types, by masking the result of integer conversions to the required bit width. The core logic for Lemire’s algorithm and the necessary type definitions are now consolidated in uniform_int_dist.h for better organization and portability.