Hi,
the beavior is coded here: https://github.com/camunda/camunda-bpm-platform/blob/00cb6645c2b82a8be0bc20af1f10df0fe546b4ea/engine/src/main/java/org/camunda/bpm/engine/impl/AbstractDefinitionDeployer.java#L333-L348
I would always treat the definitionId as a random (unique) number. You can use a ProcessDefinitionQuery to find a process definition in the runtime database.
Cheers, Ingo