Changeset 1077


Ignore:
Timestamp:
Sep 17, 2008 1:01:27 PM (11 years ago)
Author:
ladanyi
Message:

switch to using CoinDrand48() instead of rand()

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Cbc/src/CbcHeuristicRandRound.cpp

    r1072 r1077  
    1111#include <vector>
    1212
     13#include "CoinHelperFunctions.hpp"
    1314#include "OsiSolverInterface.hpp"
    1415#include "CbcModel.hpp"
     
    1718#include "OsiClpSolverInterface.hpp"
    1819#include  "CoinTime.hpp"
     20
     21static inline int intRand(const int range)
     22{
     23  return (int) floor(CoinDrand48() * range);
     24}
    1925
    2026// Default Constructor
     
    188194    {
    189195      int temp = index[i];
    190       int randNumTemp = i+(rand()%(numRows-i));
     196      int randNumTemp = i+intRand(numRows-i);
    191197      index[i]=index[randNumTemp];
    192198      index[randNumTemp]=temp;
     
    201207      if(solutions.numberSolutions  > 10000)
    202208        break;
    203       randNum = rand()%10 + 1;
    204       randNum = (int) fmod(randNum, 2);
     209      randNum = intRand(2);
    205210      for(int j=0; j<numCols; j++)
    206211        {
     
    353358      numRandomPoints++;
    354359      //generate the next random point
    355       int randomIndex = rand()%numCornerPoints;
    356       double random = rand();
    357       random = random/RAND_MAX;
     360      int randomIndex = intRand(numCornerPoints);
     361      double random = CoinDrand48();
    358362      for(int i=0; i<numCols; i++)
    359363        {
Note: See TracChangeset for help on using the changeset viewer.