Changeset 126


Ignore:
Timestamp:
Aug 3, 2004, 10:45:31 AM (17 years ago)
Author:
Peter
Message:

shuffle modified

Location:
trunk/src
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/vector.cc

    r125 r126  
    174174  }
    175175
    176   vector vector::shuffle(vector& vec) const
    177   {
    178     vector tmp_vec(vec);
     176  void vector::shuffle(void) const
     177  {
     178    vector vec(*this);
    179179    theplu::cpptools::random_singleton*
    180180      rnd=theplu::cpptools::random_singleton::get_instance();
    181181    for (size_t i=0; i<vec.size(); i++){
    182182      size_t index = rnd->get_uniform_int(vec.size()-i);
    183       vec(i)=tmp_vec(index);
    184       tmp_vec(index)=tmp_vec(vec.size()-i-1);
    185     }
    186    
    187     return vec;
     183      gsl_vector_set(v_,i,vec(index));
     184      vec(index)=vec(vec.size()-i-1);
     185    }
    188186  }
    189187
  • trunk/src/vector.h

    r125 r126  
    141141    /// vector
    142142    ///
    143     vector vector::shuffle(vector&) const;
     143    void vector::shuffle(void) const;
    144144
    145145    ///
Note: See TracChangeset for help on using the changeset viewer.