Change method to generate a string of a given length