summaryrefslogtreecommitdiff
path: root/boost/random/uniform_on_sphere.hpp
diff options
context:
space:
mode:
Diffstat (limited to 'boost/random/uniform_on_sphere.hpp')
-rw-r--r--boost/random/uniform_on_sphere.hpp8
1 files changed, 6 insertions, 2 deletions
diff --git a/boost/random/uniform_on_sphere.hpp b/boost/random/uniform_on_sphere.hpp
index 72c25ef781..ce2e35237e 100644
--- a/boost/random/uniform_on_sphere.hpp
+++ b/boost/random/uniform_on_sphere.hpp
@@ -225,8 +225,12 @@ public:
}
} while(sqsum == 0);
// for all i: result[i] /= sqrt(sqsum)
- std::transform(_container.begin(), _container.end(), _container.begin(),
- std::bind2nd(std::multiplies<RealType>(), 1/sqrt(sqsum)));
+ RealType inverse_distance = 1 / sqrt(sqsum);
+ for(typename Cont::iterator it = _container.begin();
+ it != _container.end();
+ ++it) {
+ *it *= inverse_distance;
+ }
}
}
return _container;