...one of the most highly
regarded and expertly designed C++ library projects in the
world.
— Herb Sutter and Andrei
Alexandrescu, C++
Coding Standards
boost::uniform_on_sphere
// In header: <boost/random/uniform_on_sphere.hpp> template<typename RealType = double, typename Cont = std::vector<RealType> > class uniform_on_sphere { public: // types typedef RealType input_type; typedef Cont result_type; // construct/copy/destruct uniform_on_sphere(int = 2); // public member functions void reset(); template<typename Engine> const result_type & operator()(Engine &); };
Instantiations of class template uniform_on_sphere model a random distribution . Such a distribution produces random numbers uniformly distributed on the unit sphere of arbitrary dimension dim
. The Cont
template parameter must be a STL-like container type with begin and end operations returning non-const ForwardIterators of type Cont::iterator
. Each invocation of the UniformRandomNumberGenerator
shall result in a floating-point value in the range [0,1).