Skip to content

Commit

Permalink
Merge remote-tracking branch 'DanielaE/feature/replace-deprecated-c++…
Browse files Browse the repository at this point in the history
…98-stuff' into develop
  • Loading branch information
swatanabe committed Nov 6, 2017
2 parents 87477f5 + e75d0b9 commit e4b0b2f
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 2 deletions.
8 changes: 6 additions & 2 deletions include/boost/random/uniform_on_sphere.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -225,8 +225,12 @@ class uniform_on_sphere
}
} 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;
Expand Down
2 changes: 2 additions & 0 deletions test/test_old_uniform_int_distribution.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@
// Author: Jos Hickson
BOOST_AUTO_TEST_CASE(test_random_shuffle)
{
#ifndef BOOST_NO_CXX98_RANDOM_SHUFFLE
typedef boost::uniform_int<> distribution_type;
typedef boost::variate_generator<boost::mt19937 &, distribution_type> generator_type;

Expand All @@ -73,4 +74,5 @@ BOOST_AUTO_TEST_CASE(test_random_shuffle)
BOOST_CHECK_EQUAL_COLLECTIONS(
testVec.begin(), testVec.end(),
referenceVec.begin(), referenceVec.end());
#endif
}
2 changes: 2 additions & 0 deletions test/test_random_number_generator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@

BOOST_AUTO_TEST_CASE(test_random_shuffle)
{
#ifndef BOOST_NO_CXX98_RANDOM_SHUFFLE
boost::mt19937 engine(1234);
boost::random::random_number_generator<boost::mt19937> generator(engine);

Expand All @@ -30,4 +31,5 @@ BOOST_AUTO_TEST_CASE(test_random_shuffle)
}

std::random_shuffle(testVec.begin(), testVec.end(), generator);
#endif
}

0 comments on commit e4b0b2f

Please sign in to comment.