'Draw and return a random sample from the probability distribution.'

def randomSample(self):

    assert (len(self.sampleList) > 0)
    rand = random.random()
    for (cumulProb, singleton) in self.sampleList:
        if (rand <= cumulProb):
            return singleton
    return self.sampleList[(-1)][1]
