27 template <
typename FncPtr>
46 template <
typename Rnd>
52 static inline double rnd(Rnd * r) {
return r->flat(); }
57 static inline double rnd(Rnd * r,
double xl,
double xu) {
58 return xl + (xu - xl)*
rnd(r);
72 template <
typename InputIterator,
typename OutputIterator>
73 static inline void rnd(Rnd * r, InputIterator l, InputIterator lend,
74 InputIterator u, OutputIterator res) {
75 for ( ; l != lend; ++l ) *res++ = *l + (*u++ - *l)*
rnd(r);
82 template <
typename OutputIterator>
83 static inline void rnd(Rnd * r,
int D, OutputIterator res) {
84 for (
int d = 0; d < D; ++d ) *res++ =
rnd(r);
90 static inline bool rndBool(Rnd * r,
double x) {
return rnd(r) < x; }
95 static inline bool rndBool(Rnd * r,
double x,
double y) {
101 static inline long rndInt(Rnd * r,
long x) {
102 return long(
rnd(r, 0.0,
double(x)));
static void rnd(Rnd *r, InputIterator l, InputIterator lend, InputIterator u, OutputIterator res)
Generate a set of random numbers.
ACDCFncTraits defines the interface to functions to be sampled by ACDCGen.
static void rnd(Rnd *r, int D, OutputIterator res)
Generate D random numbers.
ACDCTraitsType is an empty non-polymorphic base class for all traits classes in ACDCGenerator.
static double rnd(Rnd *r, double xl, double xu)
Return a flat random number in the interval ]xl,xu[.
static bool rndBool(Rnd *r, double x)
Return true with probability x.
static long rndInt(Rnd *r, long x)
Return a random integer in the interval [0,x[.
static double rnd(Rnd *r)
Return a flat random number in the interval ]0,1[.
vector< double > DVector
A vector of doubles.
static double value(const FncPtr &f, const DVector &x)
Call a function to be sampled by ACDCGen.
The namespace in which all ACDCGen classes are defined.
static bool rndBool(Rnd *r, double x, double y)
Return true with probability x(x + y).
ACDCRandomTraits defines the interface to random number generator objects to be used by ACDCGen...