You can register a "bean" in the processEngineConfiguration (see user guide, search for beans). This bean can point to a simple Java-class with one method, e.g. "generateId()". if you register an instance of that class in the "beans", using key "generator", you can use these kind of expressions:
"${generator.generateId()}"
This forces you to write ONE java-class, but it's available from ALL of the processes, so no additional logic/coding is involved for additional processes.
Using no code at all, not sure If I can think of anything like that, perhaps a script-exeuction/task listener that sets that variable? (I know groovy can use any Java-class, so you could use UUID in the JDK, for example).