No need for DYI. Use community commons' somewhat hidden java-action randomHash.
create a java action (no parameters, and return a string) and place this in:
at the top:
import java.util.UUID;
@Override
public java.lang.String executeAction() throws Exception
{
// BEGIN USER CODE
UUID uuid = UUID.randomUUID();
return uuid.toString();
// END USER CODE
}
You can also use the ‘Random Hash’ Java action from the Community Commons module.