Fix to for loop Math cache

This should merge back correctly with master. Only change is a 'var len' for caching idChars.length.

See: http://stackoverflow.com/questions/1349404/generate-a-string-of-5-random-characters-in-javascript