@classmethod
    def unirand(cls, samples):
        randrow = [random.random() for i in range(len(samples))]
        total = sum(randrow)
        for i, x in enumerate(randrow):
            randrow[i] = x/total

        total = sum(randrow)
        if total != 1:
            #this difference, if present, is so small (near NINF) that it
            #can be subtracted from any element without risking probs not (0 1)
            randrow[-1] -= total - 1

        return dict((s, randrow[i]) for i, s in enumerate(samples))
The key function that creates a randomized initial distribution
dataset/ETHPy150Open nltk/nltk/nltk/probability.py/RandomProbDist.unirand