C++ Logo

std-proposals

Advanced search

Re: [std-proposals] D4037R0 Allowing signed char and unsigned char in random number generation

From: Jan Schultke <janschultke_at_[hidden]>
Date: Thu, 26 Feb 2026 22:15:44 +0100
> Sorry for my ignorance, but don't all random number generators have a
> larger internal state than the size of the returned random value?
>
> Otherwise they would always output the same series of numbers.
>

Sometimes it's the same, and sometimes the returned value is
wider. independent_bits_engine can be used as an adaptor to go from any
given width to any other width.

The goal of the proposal isn't to make people use linear_congruential_engine
with 8-bit numbers or something. The goal is to make people use 8-bit
distributions using existing engines. I suppose allowing the instantiation
of engines with 8-bit types is a drive-by product, and I don't see a reason
why the user should be prohibited from doing so. If they want
absurdly-low-quality generation, more freedom to them.

Received on 2026-02-26 21:16:02