<commit_before>module Radish
  module Randomness
    def rand_one(a)
      a[rand(a.length)]
    end

    def maybe_call(&bl)
      bl.call if rand(1) > 0
    end

    def rand_one_or_nil(a)
      rand(1) > 0 ? rand_one(a) : nil
    end

    def rand_times(i = 10)
      (1 + rand(i)).times
    end

    def rand_partition(a, n)
      i = rand(a.length / 3) + 1
      n == 1 ? [a] : [a.take(i).map(&:dup)] + rand_partition(a.drop(i), n - 1)
    end

    def rand_array(n = 10)
      rand_times(n).map { yield }
    end

    def rand_array_of_numbers(n = 10)
      rand_array(n) { Faker::Number.between(1, 1000).to_i }
    end

    def rand_array_of_words(n = 10)
      rand_array(n) { Faker::Hipster.word }
    end

    def rand_array_of_uuids(n = 10)
      rand_array(n) { UUID.generate }
    end

    def rand_array_of_hexes(n = 10)
      rand_array(n) { Faker::Number.hexadecimal(6) }
    end

    def rand_array_of_urls(n = 10)
      rand_array(n) { Faker::Internet.url }
    end

    def rand_array_of_models(name, args = {}, n = 10)
      rand_array(n) { create(name, args) }
    end
  end
end<commit_msg>Remove too specific function<commit_after>module Radish
  module Randomness
    def rand_one(a)
      a[rand(a.length)]
    end

    def maybe_call(&bl)
      bl.call if rand(1) > 0
    end

    def rand_one_or_nil(a)
      rand(1) > 0 ? rand_one(a) : nil
    end

    def rand_times(i = 10)
      (1 + rand(i)).times
    end

    def rand_partition(a, n)
      i = rand(a.length / 3) + 1
      n == 1 ? [a] : [a.take(i).map(&:dup)] + rand_partition(a.drop(i), n - 1)
    end

    def rand_array(n = 10)
      rand_times(n).map { yield }
    end

    def rand_array_of_numbers(n = 10)
      rand_array(n) { Faker::Number.between(1, 1000).to_i }
    end

    def rand_array_of_words(n = 10)
      rand_array(n) { Faker::Hipster.word }
    end

    def rand_array_of_uuids(n = 10)
      rand_array(n) { UUID.generate }
    end

    def rand_array_of_hexes(n = 10)
      rand_array(n) { Faker::Number.hexadecimal(6) }
    end

    def rand_array_of_urls(n = 10)
      rand_array(n) { Faker::Internet.url }
    end
  end
end
{'fraction_non_alphanumeric': 0.1290473955889254, 'fraction_numerical': 0.028155795401220086, 'mean_word_length': 2.3364632237871676, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 7, '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': '6403977', 'n_tokens_mistral': 920, 'n_tokens_neox': 846, 'n_words': 175}