import random


def packet_loss(P):
    """Adds a uniformly distributed packet loss, returns True if packet to be dropped"""

    u = random.uniform(0, 1)
    if u < P:
        return True
    return False