I was going to disagree with you; and I was going to use a very simple function to do it `randString(length, alphabet)` where alphabet is defaulted - as azAZ09 is a good default.
However, on many non-trivial projects I've worked on we ended up making the default explicit and then creating wrappers for specific use cases (i.e. randFileName, randFilePath not being case sensitive on some platforms and randTestFilePath including additional characters for tests but production variants sticking to portable sets).
Its further worth noting that rarely do I allow the default global random to be used and instead dependency inject it via params/factories.
However, on many non-trivial projects I've worked on we ended up making the default explicit and then creating wrappers for specific use cases (i.e. randFileName, randFilePath not being case sensitive on some platforms and randTestFilePath including additional characters for tests but production variants sticking to portable sets).
Its further worth noting that rarely do I allow the default global random to be used and instead dependency inject it via params/factories.