Household Registration Act Article 49

In case the surname of the concerned party of the birth registration is not sure according to related laws, if the child is legitimate, the applicant can decide the child to be registered with the father or mother's surname upon taking a draw; if the child is illegitimate, the child is registered with the mother's surname; if the child is abandoned or helpless, the child is registered with the legal guardian's surname.Should the Household Registration Office register a child according to Subparagraph 1 of the previous Article, if the child is legitimate, the applicant can register the child with the father or mother's surname upon taking a draw; if the child is illegitimate, the child is registered with the mother's surname; if the child is abandoned or helpless, the child is registered with the legal guardian's surname and the director of the Household Registration Office should give the child a first name.
中文原文 戶籍法第49條
出生登記當事人之姓氏,依相關法律規定未能確定時,婚生子女,由申請人於戶政事務所抽籤決定依父姓或母姓登記;非婚生子女,依母姓登記;無依兒童,依監護人之姓登記。
戶政事務所依前條第一款規定逕為出生登記時,出生登記當事人姓氏,婚生子女,以抽籤決定依父姓或母姓登記;非婚生子女,依母姓登記;無依兒童,依監護人之姓登記,並由戶政事務所主任代立名字。

English translation for reference only; the Chinese text prevails. Not legal advice.