code: def throw_random_gap_list( lengths, mask, save_interval_func, allow_overlap=False ):
      
      # Use mask to find the gaps;  gaps is a list of (length,start,end)
      lengths = [length for length in lengths if length > 0]
      min_length = min( lengths )
      gaps = []
      start = end = 0
      while 1:
          start = mask.next_clear( end )
          if start == mask.size: break
          end = mask.next_set( start )
          if end-start >= min_length:
              gaps.append( ( end-start, start, None ) )
      # Sort (long regions first)    
      gaps.sort()
      gaps.reverse()
      # Throw
      throw_random_private( lengths, gaps, save_interval_func, allow_overlap, three_args=False )
docs: Generates a set of non-overlapping random intervals from a length 
      distribution.
      
      `lengths`: list containing the length of each interval to be generated.
                 We expect this to be sorted by decreasing length to minimize
                 the chance of failure (MaxtriesException) and for some
                 performance gains when allow_overlap==True and there are
                 duplicate lengths
      `mask`: a BitSet in which set bits represent regions not to place 
              intervals. The size of the region is also determined from the
              mask.