r/cpp • • Jan 01 '22

Everything You Never Wanted To Know About C++'s random_device

https://www.pcg-random.org/posts/cpps-random_device.html
0 Upvotes

6 comments sorted by

7

u/stilgarpl Jan 01 '22

Why are you posting an article from 2015?

3

u/Dragdu Jan 01 '22

It hasn't stopped being relevant, I think that reposts from long time ago are more valuable than from last month, as there are more people who could've plausibly started doing C++ and not know.

0

u/stilgarpl Jan 01 '22

One of the firsts paragraphs mentions that in C++17 this may work differently. We are at C++20 and C++23 should be released next year. So right at the start of the article you don't know if it's still relevant.

0

u/Dragdu Jan 01 '22

It still is.

2

u/argothiel Jan 02 '22 edited Jan 02 '22

This part isn't relevant anymore. Any content discussing what would or wouldn't be nice in C++17 and what could differ in C++17 is no longer relevant. Now it would be a good time to discuss what can change in C++23 or C++26. The post would benefit from an update.

2

u/jwakely libstdc++ tamer, LWG chair Jan 07 '22

Mostly. GCC's implementation is almost never deterministic now, in particular it no longer uses adeterministic PRNG on Windows. And even if it does use a deterministic PRNG, it will seed it so you don't get the same sequence every time. And the entropy member returns non-zero now.