The idea behind the code is to be a universal method which can include numbers, letters, upper and lower case as well a special characters with the provision to introduce repeats.
Having said that, the tutorial is old and I have since released a node extension which is a much better solution for node users.