I need to generate random alphanumeric string (5 or 6 char) in order to put it to specific field. Could anyone pls provide me solution ? Have tried several methods described in another posts on stack but without success.
Have tried something like that:
public static String generateString(Random rng, String characters, int length)
{
    char[] text = new char[length];
    for (int i = 0; i < length; i++)
    {
        text[i] = characters.charAt(rng.nextInt(characters.length()));
    }
    return new String(text);
}
but no idea why random is passed as an argument and what should I provide for it while calling method
 
     
     
    