WIP: RNG cleanups

Implement the changes described in #2041.