Changeset f1fb54b9f7 in tspsg for src/tspmodel.cpp


Ignore:
Timestamp:
Jan 7, 2010, 2:24:18 AM (14 years ago)
Author:
Oleksii Serdiuk
Branches:
0.1.3.145-beta1-symbian, 0.1.4.170-beta2-bb10, appveyor, imgbot, master, readme
Children:
946f442ab0
Parents:
4ccf855df8
Message:

+ Added the ability to generate fractional random numbers.
+ Added "Scroll to the end of solution output after solving" option.

  • Set the accuracy for fractional numbers on output to 2 decimail places.
  • Updated translations to reflect changes.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/tspmodel.cpp

    r4ccf855df8 rf1fb54b9f7  
    466466}
    467467
    468 inline int CTSPModel::rand(int min, int max) const
    469 {
    470         return min + (int)floor(((double)qrand() / RAND_MAX) * (max + 1 - min));
    471 }
     468inline double CTSPModel::rand(int min, int max) const
     469{
     470double r;
     471        if (settings->value("FractionalRandom", DEF_FRACTIONAL_RANDOM).toBool())
     472                r = (double)qRound((double)qrand() / RAND_MAX * (max - min) * 100) / 100;
     473        else
     474                r = qRound((double)qrand() / RAND_MAX * (max - min));
     475        return min + r;
     476}
Note: See TracChangeset for help on using the changeset viewer.