All pastes #192158 Raw Edit

Unnamed

public text v1 · immutable
·published 2006-10-05 18:46 UTC
rendered paste body
def setupFixture(self):
    ntags = 30                                                                                         
    tagnames = ["test-tag-%02d" % i for i in range(1, ntags+1)]                                        
                                                                                                           
    # assign tag frequencies by randomly sampling from a power distribution and                        
    # adding some random noise to simulate a realistic tag frequency distribution                      
    from random import randint                                                                         
    a = 1; k = 2 # as in y = a*x^k                                                                     
    tagcounts = [max(1, a*randint(1, ntags+1)**k + randint(-10, 10)) for i in range(1, ntags+1)]       
                                                                                                   
    return [{"tagger:label": tagnames[i],                                                      
             "tagger:count": tagcounts[i],
             "tagger:usertag": "dummyuser",                                                    
             "tagger:storeid": "dummyid"} for i in range(ntags)];