Who assigns the number to the engine and does it have any meaning ?
If you are asking about a real locomotive,
• the builder assigns the model identification
• the railroad/railway assigns their classification and road number
In the USA, all make general use of the Whyte classification system based on wheel arrangement.