How did people in the Ming Dynasty choose their names?

Name according to the genealogy,

Every family with stable inheritance is named strictly according to the genealogy ranked by generation.

Girls are not eligible to be included in the genealogy, so the names may be a little messy. For men, the names have already been decided.

For example, the names of the emperors of the Ming Dynasty were all radicals of the five elements.