from random import gauss


def random_mbh(type='agn'):
    """randomizes a black hole mass (in solar masses). one can choose between ``agn`` and ``xrb``."""
    if type == 'agn':
        # log M_bh = N(7.83, 0.63) (jin12)
        return 10**gauss(7.83, 0.63)
    elif type == 'xrb':
        return 10**gauss(1.1, 0.15)
    else: raise Exception('type must be agn or xrb')