Again, a direct port from backports. If a stripped down version of Random is ok, I can attempt to get rid of the icky parts. I had these same reactions when I saw both sections of this code.