import torch


def coin_flip(prob):
    """
    Return the outcome of a biased coin flip.
    Args:
        prob: the probability of True.

    Returns: bool

    """
    return prob > 0 and torch.rand(1).item() < prob