You can do something like this too:
chars = ('a'..'z').to_a + ('A'..'Z').to_a
def String.random_alphanumeric(size=16)
(0...size).collect { chars[Kernel.rand(chars.length)] }.join
end
But then you would have to compare against a database to make sure it is not used yet.