/ruby/robot-name/robot.rb

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
class Robot

  def initialize
    reset
  end

  def reset
    letters = ('A'..'Z').to_a.sample(2)
    numbers = ('0'..'9').to_a.sample(3)
    @name = (letters + numbers).join
  end

  attr_reader :name

end

Comments


You're not logged in right now. Please login via GitHub to comment