40 namespace Gecode {
namespace Support {
49 template<
unsigned int m,
unsigned int a,
unsigned int q,
unsigned int r>
53 static const unsigned int max = 1UL<<31;
57 unsigned int next(
void);
60 void seed(
unsigned int s);
64 unsigned int seed(
void)
const;
68 size_t size(
void)
const;
71 template<
unsigned int m,
unsigned int a,
unsigned int q,
unsigned int r>
74 s =
a*(s%q) -
r*(s/q);
79 template<
unsigned int m,
unsigned int a,
unsigned int q,
unsigned int r>
85 template<
unsigned int m,
unsigned int a,
unsigned int q,
unsigned int r>
91 template<
unsigned int m,
unsigned int a,
unsigned int q,
unsigned int r>
96 template<
unsigned int m,
unsigned int a,
unsigned int q,
unsigned int r>
99 unsigned int x1 = next() & ((1<<16)-1);
100 unsigned int x2 = next() & ((1<<16)-1);
102 double d =
static_cast<double>(((x1<<16) | x2) %
max) /
max;
103 unsigned int val =
static_cast<unsigned int>(n *
d);
104 return (val < n) ? val : (n-1);
106 template<
unsigned int m,
unsigned int a,
unsigned int q,
unsigned int r>
void max(Home home, FloatVar x0, FloatVar x1, FloatVar x2)
Post propagator for .
int n
Number of negative literals for node type.
unsigned int operator()(unsigned int n)
Returns a random integer from the interval [0..n)
LinearCongruentialGenerator(unsigned int s=1)
Construct the generator instance with seed s.
Template for linear congruential generators.
size_t size(void) const
Report size occupied.
unsigned int seed(void) const
Return current seed.
LinearCongruentialGenerator< 2147483647, 48271, 44488, 3399 > RandomGenerator
Default values for linear congruential generator.
Gecode toplevel namespace
struct Gecode::@518::NNF::@57::@59 a
For atomic nodes.