C++ Logo

std-proposals

Advanced search

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

From: Frederick Virchanza Gotham <cauldwell.thomas_at_[hidden]>
Date: Fri, 27 Feb 2026 23:16:08 +0000
Just while we're on the topic of random numbers . . .

How many of us here have written quick sample code and had to
copy-paste the code for setting up the random number generator?

I think C++ should have something like the following:

    std::array< uintptr_t , 666u > var;
   __rand >> var;

    std::vector< uintptr_t > var;
    var.resize( 666u );
   __rand >> var;


'__rand' would be an object of a type that has 'operator>>' defined to
populate any kind of object with random bytes. Maybe something like:

https://godbolt.org/z/Knj5vzK65

Received on 2026-02-27 23:14:29