The designator randomChild returns a randomly-chosen child of the current note (i.e. this note). If the current note has no children, randomChild returns the name of the current note. For example:
$MyString = $Name(randomChild)
Designators don't allow offset references as with attributes. Thus $Name("Some note") works but child("Some note") doesn't. If an offset designator is needed use find() instead.