Further improvements to SecureRandom

This PR goes along with #1405.