Changeset 81 in tspsg-svn for trunk/src/tspmodel.cpp
- Timestamp:
- Jan 7, 2010, 2:24:18 AM (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/tspmodel.cpp
r80 r81 466 466 } 467 467 468 inline int CTSPModel::rand(int min, int max) const 469 { 470 return min + (int)floor(((double)qrand() / RAND_MAX) * (max + 1 - min)); 471 } 468 inline double CTSPModel::rand(int min, int max) const 469 { 470 double 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.