Move `RandomModule` to its own module. Do maintenance on it.

Add tests and docstrings for random functions.