Changeset 259 for trunk/src/gslapi_utility.cc
- Timestamp:
- Mar 4, 2005, 2:09:55 AM (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/gslapi_utility.cc
r257 r259 4 4 #include <utility> 5 5 6 #include "random_singleton.h" 6 7 #include "vector.h" 7 8 … … 26 27 } 27 28 29 30 31 void shuffle(vector& invec) 32 { 33 vector vec(invec); 34 theplu::cpptools::random_singleton* 35 rnd=theplu::cpptools::random_singleton::get_instance(); 36 for (size_t i=0; i<vec.size(); i++){ 37 size_t index = rnd->get_uniform_int(vec.size()-i); 38 invec[i]=vec(index); 39 vec(index)=vec(vec.size()-i-1); 40 } 41 } 42 28 43 }} // of namespace gslapi and namespace thep
Note: See TracChangeset
for help on using the changeset viewer.