I've got a method that generates random strings:
def generate_letters(length)
chars = 'ABCDEFGHJKLMNOPQRSTUVWXYZ'
letters = ''
length.times { |i| letters << chars[rand(chars.length)] }
letters
end
I want to map values to generated strings, e.g.(1): A = 1, B = 2, C = 3 , e.g.(2): if I generate ACB it equals to 132. Any suggestions?
132base on generated string'ACB'or you need smth else?'BAC'string I want to recognize it as213