Refactor RandomString in a class.