You could also use a microflow that generates an random string based on an input string that specifies all allowed characters and an int that defines how long the result should be.
Edit: You might also want to add a validation check to ensure that the random part does not become 1. Otherwise you could end up with an index out of bound or something like that.
then you do something like:
$index = round(random()*length($allowedChars)) $result = $result+substring($allowedChars,$index,1) length($result) = $length if true quit microflow and return result, if false loop back to the start and result will append to itself.
Note that the community commons module contains a randomString function that creates alphanumeric random strings of a specified length.
Create a java action to get a random number and return it as a string, like:
... import java.util.Random; ... // BEGIN USER CODE Random randomGenerator = new Random(); int randomInt = randomGenerator.nextInt(100); String tmpNbr = Integer.toString(randomInt); return tmpNbr; // END USER CODE
The code above will return a random number between 0 and 99 as a text string that you can then concatenate with your text using a simple change action.
Use an Enum with the number to character translation.
This also allows you to use Uppercase and (to some extend) special character results.