Use a context manager for RNG