Changeset 259 for trunk/src/vector.cc


Ignore:
Timestamp:
Mar 4, 2005, 2:09:55 AM (18 years ago)
Author:
Jari Häkkinen
Message:

Moved out shuffle from vecotr class.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/vector.cc

    r257 r259  
    22
    33#include "vector.h"
    4 #include "random_singleton.h"
    54
    65#include <iostream>
     
    170169
    171170
    172   void vector::shuffle(void) const
    173   {
    174     vector vec(*this);
    175     theplu::cpptools::random_singleton*
    176       rnd=theplu::cpptools::random_singleton::get_instance();
    177     for (size_t i=0; i<vec.size(); i++){
    178       size_t index = rnd->get_uniform_int(vec.size()-i);
    179       gsl_vector_set(v_,i,vec(index));
    180       vec(index)=vec(vec.size()-i-1);
    181     }
    182   }
    183 
    184171  double vector::sum(void) const
    185172  {
Note: See TracChangeset for help on using the changeset viewer.