Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
08/08/08 19:56:19 (16 years ago)
Author:
gkronber
Message:

fixed #238 by using floor instead of round when we use a uniform-distribution in combination with integer variables

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.Random/NormalRandomAdder.cs

    r426 r469  
    8888
    8989      public override void Visit(ConstrainedDoubleData data) {
    90 
    9190        for(int tries = MAX_NUMBER_OF_TRIES; tries >= 0; tries--) {
    9291          double newValue = data.Data + normal.NextDouble();
    93 
    9492          if(IsIntegerConstrained(data)) {
    9593            newValue = Math.Round(newValue);
     
    9997          }
    10098        }
    101 
    10299        throw new InvalidProgramException("Coudn't find a valid value");
    103100      }
     
    112109            return;
    113110        }
    114 
    115111        throw new InvalidProgramException("Couldn't find a valid value.");
    116112      }
Note: See TracChangeset for help on using the changeset viewer.