I don’t know which version of PyMC you’re using. We have examples of random function for the latest version in the docstrings: pymc.CustomDist — PyMC dev documentation
The signature has changed, and should now be def random(*params, rng, size):
DensityDist is just an alias for CustomDist now