KF6 and STL compatibility
Open, Needs TriagePublic


In D24985 @apol suggested using KRandom while @anthonyfieroni noted that std::random_shuffle is deprecated and removed in C++17 (which will be available with Qt6). However KRandom::random cannot be used with std::shuffle because it doesn't fulfill the requirements of UniformRandomBitGenerator. Surely there are more places which would benefit from better compatibility to the standard library.

davidre created this task.Nov 6 2019, 9:42 AM

Or maybe some things could be dropped if there is an equivalent feature in the standard.

davidre moved this task from Backlog to Needs Input on the KF6 board.Nov 6 2019, 9:45 AM
mwolff added a subscriber: mwolff.Nov 22 2019, 9:18 AM

KRandom::random should be removed and QRandomGenerator should be used instead. It has a more expressive API and will actually work properly on platforms without a /dev/urandom.

KRandom::random() -> QRandomGenerator::global()->generate()

Random string otoh could be kept if needed but should use QRandomGenerator internally