Run the chain and store the history of visited points into
        the member variable ``self.samples``. Returns the number of
        accepted points during the run.

        .. seealso::
            :py:class:`pypmc.tools.History`

        :param N:

            An int which defines the number of steps to run the chain.

def run(self, N=1):
        '''Run the chain and store the history of visited points into
        the member variable ``self.samples``. Returns the number of
        accepted points during the run.

        .. seealso::
            :py:class:`pypmc.tools.History`

        :param N:

            An int which defines the number of steps to run the chain.

        '''
        if N == 0:
            return 0

        # set the accept function
        if self.proposal.symmetric:
            get_log_rho = self._get_log_rho_metropolis
        else:
            get_log_rho = self._get_log_rho_metropolis_hastings

        # allocate an empty numpy array to store the run
        if self.target_values is not None:
            this_target_values = self.target_values.append(N)
        this_run     = self.samples.append(N)
        accept_count = 0

        for i_N in range(N):
            # propose new point
            proposed_point = self.proposal.propose(self.current_point, self.rng)
            proposed_eval  = self.target(proposed_point)

            # log_rho := log(probability to accept point), where log_rho > 0 is meant to imply rho = 1
            log_rho = get_log_rho(proposed_point, proposed_eval)

            # check for NaN
            if _np.isnan(log_rho): raise ValueError('encountered NaN')

            # accept if rho = 1
            if log_rho >=0:
                accept_count += 1
                this_run[i_N]            = proposed_point
                self.current_point       = proposed_point
                self.current_target_eval = proposed_eval

            # accept with probability rho
            elif log_rho >= _np.log(self.rng.rand()):
                accept_count += 1
                this_run[i_N]            = proposed_point
                self.current_point       = proposed_point
                self.current_target_eval = proposed_eval

            # reject if not accepted
            else:
                this_run[i_N] = self.current_point
                #do not need to update self.current
                #self.current = self.current

            # save target value if desired
            if self.target_values is not None:
                this_target_values[i_N] = self.current_target_eval

        # ---------------------- end for --------------------------------

        return accept_count