From: "Iñaki Baz Castillo" Date: 2011-01-28T03:32:24+09:00 Subject: Generate randon string of fixed length (in bytes) Hi, I use the following method to generate a random string: def gen_token(len=6) rand(36**len).to_s(36) end It's the most efficiente way I've found. However even if the parameter is 6, the method sometimes returns a string of lenght 5, 4... Is there an efficient way to a random string with fixed length? (I don't want to check the resulting length and then append some other byte....). Thanks a lot. -- Iñaki Baz Castillo