Re:C++ Coroutines Do Not Spark Joy
by steerablesafe on Monday November 01, 2021 @10:29AM
(#29067000)
Apart from not being very random, it also wasn't thread-safe.
Re:C++ Coroutines Do Not Spark Joy
by physicsguy on Tuesday November 02, 2021 @06:24AM
(#29079206)
I think of the C++11 RNG stuff is thread safe, you need to lock around it or have an RNG per thread.
Sure, that version was cryptographically insecure, but 95% of the use cases of shuffling have nothing to do with cryptography and don't need to be secured. This is not a case like PHP's `mysql_query` which has an easy replacement: now you must declare an `std::random_device` and `std::mt19937` and pass them to your functions.
This nearly made me fail a job interview in an embarrassing way.
[1] https://en.cppreference.com/w/cpp/algorithm/random_shuffle