Boost C++ Libraries of the most highly regarded and expertly designed C++ library projects in the world. Herb Sutter and Andrei Alexandrescu, C++ Coding Standards

This is the documentation for an old version of boost. Click here for the latest Boost documentation.

Class template uniform_on_sphere



// In header: <boost/random/uniform_on_sphere.hpp>

template<typename RealType = double, typename Cont = std::vector<RealType> > 
class uniform_on_sphere {
  // 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).

uniform_on_sphere public construct/copy/destruct

  1. uniform_on_sphere(int dim = 2);

    Constructs a uniform_on_sphere distribution. dim is the dimension of the sphere.

uniform_on_sphere public member functions

  1. void reset();
  2. template<typename Engine> const result_type & operator()(Engine & eng);