<div dir="ltr"><div class="gmail_extra"><br><div class="gmail_quote">On Mon, Mar 3, 2014 at 7:08 PM, Adrian Prantl <span dir="ltr"><<a href="mailto:aprantl@apple.com" target="_blank">aprantl@apple.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div>I was thinking about something akin to this (possibly less ugly ;-):</div><br><div><div class=""><span style="font-family:Menlo-Regular">#if __cplusplus >= 201103L && !defined(NDEBUG)</span><br style="font-family:Menlo-Regular">
</div><span style="font-family:Menlo-Regular"> if (SROARandomShuffleSlices) {</span><div class=""><br style="font-family:Menlo-Regular"><span style="font-family:Menlo-Regular"> std::mt19937 MT(static_cast<unsigned>(sys::TimeValue::now().msec()));</span><br style="font-family:Menlo-Regular">
</div><span style="font-family:Menlo-Regular"> std::shuffle(Slices.begin(), Slices.end(), MT);</span><br style="font-family:Menlo-Regular"><span style="font-family:Menlo-Regular"> std::stable_sort(Slices.begin(), Slices.end());</span><br style="font-family:Menlo-Regular">
<span style="font-family:Menlo-Regular"> } else</span></div><div><span style="font-family:Menlo-Regular">#else</span><div class=""><br style="font-family:Menlo-Regular"><span style="font-family:Menlo-Regular"> // Sort the uses. This arranges for the offsets to be in ascending order,</span><br>
<span style="font-family:Menlo-Regular"> // and the sizes to be in descending order.</span><br style="font-family:Menlo-Regular"><span style="font-family:Menlo-Regular"> std::sort(Slices.begin(), Slices.end());</span></div>
</div><div><span style="font-family:Menlo-Regular">#endif</span></div></blockquote></div><br>There really is no need for this.</div><div class="gmail_extra"><br></div><div class="gmail_extra">The shuffle just adds entropy that sort probably doesn't. It isn't like sort is going to remove the entropy added by shuffle.</div>
</div>