Free cookie consent management tool by TermsFeed Policy Generator

Changeset 17491


Ignore:
Timestamp:
04/02/20 09:43:50 (5 years ago)
Author:
gkronber
Message:

#3067: fix reproducability by calling the PRNG only when probability is < 1

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.4/Crossovers/SubtreeCrossover.cs

    r17490 r17491  
    106106      double probability,
    107107      double internalCrossoverPointProbability, int maxTreeLength, int maxTreeDepth) {
    108       if (random.NextDouble() >= probability) return random.NextDouble() < 0.5 ? parent0 : parent1;
     108      if ((probability < 1) && (random.NextDouble() >= probability)) return random.NextDouble() < 0.5 ? parent0 : parent1;
    109109      // select a random crossover point in the first parent
    110110      CutPoint crossoverPoint0;
Note: See TracChangeset for help on using the changeset viewer.