<table><tr><td style="">tfry updated this revision to Diff 14831.<br />tfry added a comment.
</td><a style="text-decoration: none; padding: 4px 8px; margin: 0 8px 8px; float: right; color: #464C5C; font-weight: bold; border-radius: 3px; background-color: #F7F7F9; background-image: linear-gradient(to bottom,#fff,#f1f0f1); display: inline-block; border: 1px solid rgba(71,87,120,.2);" href="https://phabricator.kde.org/D5966" rel="noreferrer">View Revision</a></tr></table><br /><div><div><p>Ensure proper per-thread random-seeding in KRandom::random().</p>
<p>As commented, the problem is somewhat different, than I though, originally:</p>
<p>qsrand() and qrand() keep random seeds per QThread, and each thread needs a separate call<br />
to qsrand(). Without this patch, qsrand() would only be called for the first thread to call<br />
KRandom::random(). Any other thread will effectively use qsrand(1).</p>
<p>Note that prior to <a href="https://phabricator.kde.org/R244:9ae6d765b37135bbfe3a8b936e5a88b8a435e424" style="background-color: #e7e7e7;
border-color: #e7e7e7;
border-radius: 3px;
padding: 0 4px;
font-weight: bold;
color: black;text-decoration: none;" rel="noreferrer">9ae6d765b37135bbfe3a8b936e5a88b8a435e424</a> srand() and rand() were used.<br />
Those are not properly thread-safe, but at least this would not result in threads using a<br />
fixed seed.</p></div></div><br /><div><strong>REPOSITORY</strong><div><div>R244 KCoreAddons</div></div></div><br /><div><strong>CHANGES SINCE LAST UPDATE</strong><div><a href="https://phabricator.kde.org/D5966?vs=14824&id=14831" rel="noreferrer">https://phabricator.kde.org/D5966?vs=14824&id=14831</a></div></div><br /><div><strong>BRANCH</strong><div><div>master</div></div></div><br /><div><strong>REVISION DETAIL</strong><div><a href="https://phabricator.kde.org/D5966" rel="noreferrer">https://phabricator.kde.org/D5966</a></div></div><br /><div><strong>AFFECTED FILES</strong><div><div>src/lib/randomness/krandom.cpp</div></div></div><br /><div><strong>To: </strong>tfry, dfaure<br /><strong>Cc: </strong>tfry, rjvbb, Frameworks<br /></div>