How random do you want? You could also do something like use the Encryption library to produce one or more random numbers with the SecureRandom function. Use one of the message digest functions in the Encryption library to create a digest string, and then select nine characters from it, either using the function above, or simply picking a random start position for a substring.