48 #ifndef _MIRA_UNIFORMRANDOMGENERATOR_H_ 49 #define _MIRA_UNIFORMRANDOMGENERATOR_H_ 64 class UniformRealBoostWorkaround :
public boost::uniform_real<T>
66 typedef boost::uniform_real<T> Base;
69 explicit UniformRealBoostWorkaround(T min_arg = T(0.0),
71 Base(min_arg, max_arg) {}
73 template<
class Engine>
74 typename Base::result_type operator()(Engine& eng)
const 77 if(this->min()==this->max())
80 return Base::operator()(eng);
84 template <
typename T,
bool IsInteger>
85 struct UniformRandomDistributionHelper {
86 #if BOOST_VERSION >= 104700 87 typedef UniformRealBoostWorkaround<T>
type;
89 typedef boost::uniform_real<T>
type;
94 struct UniformRandomDistributionHelper<T,true> {
95 typedef boost::uniform_int<T>
type;
99 struct UniformRandomDistributionChooser :
100 public UniformRandomDistributionHelper<T,std::numeric_limits<T>::is_integer>
124 template <
typename T>
126 public RandomGenerator<typename detail::UniformRandomDistributionChooser<T>::type>
131 Base(Distribution(vmin,vmax)) {}
specialize cv::DataType for our ImgPixel and inherit from cv::DataType<Vec>
Definition: IOService.h:67
detail::UniformRandomDistributionChooser< T >::type & distribution()
Provides direct access to the underlying random distribution.
Definition: RandomGenerator.h:210
Template class to easily generate random generators using the boost::random distributions and generat...
Definition: RandomGenerator.h:96
PropertyHint type(const std::string &t)
Sets the attribute "type" to the specified value.
Definition: PropertyHint.h:295
#define MIRA_RANDOM_GENERATOR_COMMON(Derived, TDistribution)
Macro to be used in derived random generators to supply the default interface such copy constructors ...
Definition: RandomGenerator.h:249
Helper singleton to easily generate random generators using the boost::random distributions and gener...