tfry updated this revision to Diff 14831. tfry added a comment.
Ensure proper per-thread random-seeding in KRandom::random(). As commented, the problem is somewhat different, than I though, originally: qsrand() and qrand() keep random seeds per QThread, and each thread needs a separate call to qsrand(). Without this patch, qsrand() would only be called for the first thread to call KRandom::random(). Any other thread will effectively use qsrand(1). Note that prior to https://phabricator.kde.org/R244:9ae6d765b37135bbfe3a8b936e5a88b8a435e424 srand() and rand() were used. Those are not properly thread-safe, but at least this would not result in threads using a fixed seed. REPOSITORY R244 KCoreAddons CHANGES SINCE LAST UPDATE https://phabricator.kde.org/D5966?vs=14824&id=14831 BRANCH master REVISION DETAIL https://phabricator.kde.org/D5966 AFFECTED FILES src/lib/randomness/krandom.cpp To: tfry, dfaure Cc: tfry, rjvbb, #frameworks