def pick(self, mutlen, avoidN=False, usebed=False):
        goodmut = False

        if usebed:
            seg = random.choice(self.bed)
            rpos = int(random.uniform(seg[1], seg[2]))
            return seg[0], rpos, rpos + mutlen

        else:
            goodmut = False
            while not goodmut: 
                rchrom = random.choice(self.chrmap)
                rpos   = int(random.uniform(1, self.chrlen[rchrom]))

                if avoidN and 'N' not in self.ref.fetch(rchrom, rpos-1, rpos+mutlen):
                    goodmut = True

                if not avoidN:
                    goodmut = True

            return rchrom, rpos, rpos + mutlen
return a random chromosome and position
dataset/ETHPy150Open adamewing/bamsurgeon/scripts/randomsites.py/Genome.pick