Since we're only locking `random`, you can move these to right above the `return`.