'create a trial vector based on a mutation strategy'

def _mutate(self, candidate):

    trial = np.copy(self.population[candidate])
    rng = self.random_number_generator
    fill_point = rng.randint(0, self.parameter_count)
    if ((self.strategy == 'randtobest1exp') or (self.strategy == 'randtobest1bin')):
        bprime = self.mutation_func(candidate, self._select_samples(candidate, 5))
    else:
        bprime = self.mutation_func(self._select_samples(candidate, 5))
    if (self.strategy in self._binomial):
        crossovers = rng.rand(self.parameter_count)
        crossovers = (crossovers < self.cross_over_probability)
        crossovers[fill_point] = True
        trial = np.where(crossovers, bprime, trial)
        return trial
    elif (self.strategy in self._exponential):
        i = 0
        while ((i < self.parameter_count) and (rng.rand() < self.cross_over_probability)):
            trial[fill_point] = bprime[fill_point]
            fill_point = ((fill_point + 1) % self.parameter_count)
            i += 1
        return trial
