code: def get_random_sequences(self, n=10, length=200, chroms=None, max_n=0.1):
           
          retries = 100
          cutoff = length * max_n
          if not chroms:
              chroms = self.keys()
     
          try:
              gap_sizes = self.gap_sizes()
          except:
              gap_sizes = {}
          sizes = dict([(chrom, len(self[chrom]) - gap_sizes.get(chrom, 0)) for chrom in chroms])
     
          l = [(sizes[x], x) for x in chroms if 
                  sizes[x] / len(self[x]) > 0.1 and sizes[x] > 10 * length]
          chroms = _weighted_selection(l, n)
          coords = []
          
          count = {}
          for chrom in chroms:
              if chrom in count:
                  count[chrom] += 1
              else:
                  count[chrom] = 1
  
          for chrom in chroms:
              for i in range(retries):
                  start = int(random.random() * (sizes[chrom] - length))
                  end = start + length
                  count_n = self[chrom][start:end].seq.upper().count("N")
                  if count_n <= cutoff:
                      break
              if count_n > cutoff:
                  raise ValueError("Failed to find suitable non-N sequence for {}".format(chrom))
              
              coords.append([chrom, start, end])
  
          return coords
docs: Return random genomic sequences.
  
          Parameters
          ----------
          n : int , optional
              Number of sequences to return.
  
          length : int , optional
              Length of sequences to return.
  
          chroms : list , optional
              Return sequences only from these chromosomes.
  
          max_n : float , optional
              Maximum fraction of Ns.
  
          Returns
          -------
          coords : list
              List with [chrom, start, end] genomic coordinates.