Ignore:
Timestamp:
03/29/24 23:30:34 (2 weeks ago)
Author:
Maciej Komosinski
Message:

Introduced overloads for rndUint() with size_t and int arguments to avoid numerous type casts in sources

File:
1 edited

Legend:

Unmodified
Added
Removed
  • cpp/frams/genetics/fB/fB_oper.cpp

    r1273 r1298  
    252252        {
    253253                std::list<SString> tokenized = tokenizeSequence(line);
    254                 int rndid = rndUint((int)tokenized.size()); // select random letter from genotype
     254                int rndid = rndUint(tokenized.size()); // select random letter from genotype
    255255                // increment/decrement character - when overflow happens, this method
    256256                // uses the "reflect" approach
     
    291291                std::list<SString> tokenized = tokenizeSequence(line);
    292292                std::list<SString>::iterator it = tokenized.begin();
    293                 int rndid = rndUint((int)tokenized.size()); // select random insertion point
     293                int rndid = rndUint(tokenized.size()); // select random insertion point
    294294                std::advance(it, rndid);
    295295                NeuroClass *cls = getRandomNeuroClass(Model::SHAPETYPE_BALL_AND_STICK);
     
    312312                chg = 1.0 / line.length();
    313313                std::list<SString> tokenized = tokenizeSequence(line);
    314                 int rndid = rndUint((int)tokenized.size()); // select random insertion point
     314                int rndid = rndUint(tokenized.size()); // select random insertion point
    315315                std::list<SString>::iterator it = tokenized.begin();
    316316                std::advance(it, rndid);
     
    326326                std::list<SString> tokenized = tokenizeSequence(line);
    327327                std::list<SString>::iterator it = tokenized.begin();
    328                 int rndid = rndUint((int)tokenized.size()); // select random deletion point
     328                int rndid = rndUint(tokenized.size()); // select random deletion point
    329329                std::advance(it, rndid);
    330330                tokenized.erase(it);
     
    348348                for (int i = 0; i < 4; i++)
    349349                {
    350                         cuts[i] = rndUint((int)tokenized.size());
     350                        cuts[i] = rndUint(tokenized.size());
    351351                }
    352352                std::sort(cuts.begin(), cuts.end());
Note: See TracChangeset for help on using the changeset viewer.