def makeRandomPrediction(model, before):
    probability_distribution = model[before]
    # this should sum up to 1 and be nonnegative.

    continuous_choice = random.random()
    for i, probability in enumerate(probability_distribution):
        if probability >= continuous_choice:
            return i
        else:
            continuous_choice -= probability
    #If you're here there's a problem
    return "There's an error in prediction"
model: a k by k list of lists of floats.
dataset/ETHPy150Open yashsavani/rechorder/motif_sil.py/makeRandomPrediction