Helper Function to return a random node
def randomNodeUtil ( root , count ) : NEW_LINE INDENT if root == None : NEW_LINE INDENT return 0 NEW_LINE DEDENT if count == children ( root . left ) : NEW_LINE INDENT return root . data NEW_LINE DEDENT if count < children ( root . left ) : NEW_LINE INDENT return randomNodeUtil ( root . left , count ) NEW_LINE DEDENT return randomNodeUtil ( root . right , count - children ( root . left ) - 1 ) NEW_LINE DEDENT