<commit_before>module Expertsort
  module SleepSort
    def sleepsort
      sorted = []
      threads = []
      semaphore = Mutex.new

      # Reduce potential impact of thread creation time by joining them when all threads have been created
      self.each do |e|
        raise RangeError, "Cannot sleep sort an array with negative elements: #{e}" if e.to_i < 0
        threads << Thread.new do
          sleep e.to_i
          semaphore.synchronize { sorted << e.to_i }
        end
      end

      threads.each { |t| t.join }
      sorted
    end

    def sleepsort!
      self.replace(sleepsort)
    end
  end
end<commit_msg>Fix sleepsort converting elements to integers.<commit_after>module Expertsort
  module SleepSort
    def sleepsort
      sorted = []
      threads = []
      semaphore = Mutex.new

      # Reduce potential impact of thread creation time by joining them when all threads have been created
      self.each do |e|
        raise RangeError, "Cannot sleep sort an array with negative elements: #{e}" if e.to_i < 0
        threads << Thread.new do
          sleep e.to_i
          semaphore.synchronize { sorted << e }
        end
      end

      threads.each { |t| t.join }
      sorted
    end

    def sleepsort!
      self.replace(sleepsort)
    end
  end
end
{'fraction_non_alphanumeric': 0.06832298136645963, 'fraction_numerical': 0.0015527950310559005, 'mean_word_length': 2.0690476190476192, 'pattern_counts': {'":': 0, '<': 13, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2866391', 'n_tokens_mistral': 382, 'n_tokens_neox': 379, 'n_words': 134}