Beispiel #1
0
def generateRandomSequencesss(runs,length):
    GenSequence.generate(runs)
    f=open('GeneratedSequences.txt', 'r')
    sequences = f.read().split()
    random.seed(time.clock())
    for i in xrange(runs):
        p1 = int(math.floor(len(sequences[i])*random.uniform(0,1)))
        p2 = p1+length
        sequences[i] = sequences[i][p1:p2]
    return sequences
Beispiel #2
0
def generateRandomSequences(runs,min_bound,max_bound):
    GenSequence.generate(runs)
    f=open('GeneratedSequences.txt', 'r')
    sequences = f.read().split()
    random.seed(time.clock())
    for i in xrange(runs):
        p1 = int(math.floor(len(sequences[i])*random.uniform(0,1)))
        p2 = int(math.floor(len(sequences[i])*random.uniform(0,1)))
        while (abs(p2-p1)>=max_bound) or (abs(p2-p1)<min_bound) or p1==p2:
            p1 = int(math.floor(len(sequences[i])*random.uniform(0,1)))
            p2 = int(math.floor(len(sequences[i])*random.uniform(0,1)))
        if(p2>p1):
            sequences[i] = sequences[i][p1:p2]
        else:
            sequences[i] = sequences[i][p2:p1]
    f.close()
    return sequences