summaryrefslogtreecommitdiff
path: root/lib/trocla/util.rb
blob: 468206d0cb95886d75caac1bfabfab43542e6873 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
class Trocla
  class Util
    class << self
      def random_str(length=12)
        (1..length).collect{|a| chars[rand(chars.size)] }.join.to_s
      end
      
      private
      def chars
        @chars ||= (('a'..'z').to_a + ('A'..'Z').to_a + ('0'..'9').to_a) + "+*%/()@&=?![]{}-_.,;:<>".split(//)
      end
    end
  end
end