The angular emission pattern of a random laser is typically very irregular and difficult to tune. Here we show by detailed numerical calculations that one can overcome the lack of control over this emission pattern by actively shaping the spatial pump distribution. We demonstrate, in particular, how to obtain customized pump profiles to achieve highly directional emission. Going beyond the regime of strongly scattering media where localized modes with a given directionality can simply be selected by the pump, we present an optimization-based approach which shapes extended lasing modes in the weakly scattering regime according to any predetermined emission pattern.