<commit_before>require 'minesweeper'

module Minesweeper
  module Console
    class MinefieldInitializer
      def initialize(a_minefield)
        raise ArgumentError, 'A non nil minefield is required to create an instance.' if a_minefield.nil?
        @minefield = a_minefield
      end

      def generate(quantity_of_mines)
        raise ArgumentError, 'The specified quantity must be an integer.' unless quantity_of_mines.is_a?(Integer)
        raise ArgumentError, 'The specified quantity exceeds the minefield size.' if quantity_of_mines > @minefield.size * @minefield.size
        Array.new(quantity_of_mines) { |i| [i, 0] }
      end
    end
  end
end
<commit_msg>Start to use rand() to generate mine coordinates in the minefield_initializer<commit_after>require 'minesweeper'

module Minesweeper
  module Console
    class MinefieldInitializer
      def initialize(a_minefield)
        raise ArgumentError, 'A non nil minefield is required to create an instance.' if a_minefield.nil?
        @minefield = a_minefield
      end

      def generate(quantity_of_mines)
        unless quantity_of_mines.is_a?(Integer)
          raise ArgumentError, 'The specified quantity must be an integer.'
        end

        if quantity_of_mines > @minefield.size * @minefield.size
          raise ArgumentError, 'The specified quantity exceeds the minefield size.'
        end

        mines = []
        quantity_of_mines.times { mines << [rand(@minefield.size), rand(@minefield.size)] }
        mines
      end
    end
  end
end

{'fraction_non_alphanumeric': 0.06614276358873608, 'fraction_numerical': 0.0006548788474132286, 'mean_word_length': 3.0423280423280423, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, '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': '2644099', 'n_tokens_mistral': 438, 'n_tokens_neox': 431, 'n_words': 136}