Changeset 896 for cpp/frams/genetics/fT


Ignore:
Timestamp:
11/30/19 01:30:22 (5 years ago)
Author:
Maciej Komosinski
Message:

Replaced #defined macros for popular random-related operations with functions

File:
1 edited

Legend:

Unmodified
Added
Removed
  • cpp/frams/genetics/fT/fTest_oper.cpp

    r779 r896  
    11// This file is a part of Framsticks SDK.  http://www.framsticks.com/
    2 // Copyright (C) 1999-2015  Maciej Komosinski and Szymon Ulatowski.
     2// Copyright (C) 1999-2019  Maciej Komosinski and Szymon Ulatowski.
    33// See LICENSE.txt for details.
    44
     
    8888        int changes = 0, len = strlen(geno);
    8989        for (int i = 0; i < len; i++)
    90                 if (rnd01 < prob) //normalize prob with length of genotype
     90                if (rndDouble(1) < prob) //normalize prob with length of genotype
    9191                {
    92                         geno[i] = a[randomN(4)];
     92                        geno[i] = a[rndUint(4)];
    9393                        changes++;
    9494                }
     
    101101{
    102102        int len1 = strlen(g1), len2 = strlen(g2);
    103         int p1 = randomN(len1);  //random cut point for first genotype
    104         int p2 = randomN(len2);  //random cut point for second genotype
     103        int p1 = rndUint(len1);  //random cut point for first genotype
     104        int p2 = rndUint(len2);  //random cut point for second genotype
    105105        char *child1 = (char*)malloc(p1 + len2 - p2 + 1);
    106106        char *child2 = (char*)malloc(p2 + len1 - p1 + 1);
Note: See TracChangeset for help on using the changeset viewer.