<commit_before># Die Class 1: Numeric
#
# Written by <NAME>
#
# I worked on this challenge by myself

# I spent [] hours on this challenge.

# 0. Pseudocode

# Input: An integer of the number of sides of a die
# Output: Number of sides of a die or a random number
# Steps: 
# Check that there is at least 1 side to the dice, if there is less than 1 side, give an error message.
#


# 1. Initial Solution

#class Die
#  def initialize(sides)
#    if sides < 1
#    	raise ArgumentError.new("Sides must be at least 1")
#    end
#    @sides = sides
#  end#

#  def sides
#    @sides
#  end#

#  def roll
#    rand(@sides) + 1
#  end
#end



# 3. Refactored Solution

class Die
  def initialize(sides)
  	sides < 1 ? (raise ArgumentError.new("Sides must be at least 1")): @sides = sides
  end

  def sides
    @sides
  end

  def roll
    rand(1..@sides)
  end
end



# 4. Reflection
# What is an ArgumentError and why would you use one?
#
# An ArgumentError is an error message that is given when one of the arguments provided is invalid.
# You would use an ArgumentError to tell the person calling the method that their argument is invalid and they need to correct it in order for the program to run properly

# What new Ruby methods did you implement? What challenges and successes did you have in implementing them?
# I used the rand method for this challenge. It was quite easy to implement. I was able to make the rand method easier to understand with my refactored form of the method.

# What is a Ruby class?
# A class is a blue print for the individual objects.

# Why would you use a Ruby class?
# It creates clean and easy to read code, as well as helping the process of writing code become easier by having a blueprint of objects already pre-written.

# What is the difference between a local variable and an instance variable?
# A local variable is only usable within the block of code it lives in
# An instance variable is visible anywhere there is an instance of the class where the variable was defined.

# Where can an instance variable be used?
# An instance variable can be used anywhere within the instance of its class.<commit_msg>Update my_solution.rb<commit_after># Die Class 1: Numeric
#
# Written by <NAME>
#
# I worked on this challenge by myself

# I spent [] hours on this challenge.

# 0. Pseudocode

# Input: An integer of the number of sides of a die
# Output: Number of sides of a die or a random number
# Steps: 
# Check that there is at least 1 side to the dice, if there is less than 1 side, give an error message.
# Make an instance variable of sides equal to the number of sides of the dice.
# Sides Method:  Return the sides instance variable in the sides method.
# Roll Method: Return a random number less than or equal to the number of sides.


# 1. Initial Solution

#class Die
#  def initialize(sides)
#    if sides < 1
#    	raise ArgumentError.new("Sides must be at least 1")
#    end
#    @sides = sides
#  end#

#  def sides
#    @sides
#  end#

#  def roll
#    rand(@sides) + 1
#  end
#end



# 3. Refactored Solution

class Die
  def initialize(sides)
  	sides < 1 ? (raise ArgumentError.new("Sides must be at least 1")): @sides = sides
  end

  def sides
    @sides
  end

  def roll
    rand(1..@sides)
  end
end



# 4. Reflection
# What is an ArgumentError and why would you use one?
#
# An ArgumentError is an error message that is given when one of the arguments provided is invalid.
# You would use an ArgumentError to tell the person calling the method that their argument is invalid and they need to correct it in order for the program to run properly

# What new Ruby methods did you implement? What challenges and successes did you have in implementing them?
# I used the rand method for this challenge. It was quite easy to implement. I was able to make the rand method easier to understand with my refactored form of the method.

# What is a Ruby class?
# A class is a blue print for the individual objects.

# Why would you use a Ruby class?
# It creates clean and easy to read code, as well as helping the process of writing code become easier by having a blueprint of objects already pre-written.

# What is the difference between a local variable and an instance variable?
# A local variable is only usable within the block of code it lives in
# An instance variable is visible anywhere there is an instance of the class where the variable was defined.

# Where can an instance variable be used?
# An instance variable can be used anywhere within the instance of its class.

{'fraction_non_alphanumeric': 0.05335097001763668, 'fraction_numerical': 0.005731922398589065, 'mean_word_length': 3.4349951124144673, 'pattern_counts': {'":': 0, '<': 9, '<?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': '5302065', 'n_tokens_mistral': 1289, 'n_tokens_neox': 1237, 'n_words': 739}