Very cool approach! I noticed that you disallowed leading zeros, and I think that's a good choice because the function returns a number, not a string, and leading zeros would be ignored anyway. The only time I think a zero might be expected as the first digit would be when calling getRandom(1). You might expect 0 to be a possible result then, but it's not currently.
Love the function; very creative.
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
Very cool approach! I noticed that you disallowed leading zeros, and I think that's a good choice because the function returns a number, not a string, and leading zeros would be ignored anyway. The only time I think a zero might be expected as the first digit would be when calling
getRandom(1)
. You might expect0
to be a possible result then, but it's not currently.Love the function; very creative.