30 #ifndef QUICKCHECK_GENERATE_H 
   31 #define QUICKCHECK_GENERATE_H 
   39 namespace quickcheck {
 
   55    A offset = 
static_cast<A
>(double(rand()) / RAND_MAX
 
   56                              * (double(high) - double(low) + 1));
 
   57    return static_cast<A
>(low + offset);
 
   68 template<
class A, 
class Iter>
 
   71    assert(std::distance(first, last) > 0);
 
   72    size_t len = size_t(std::distance(first, last));
 
   76    for (i = first; index != 0; ++i)
 
   97    assert(std::numeric_limits<A>::is_integer);
 
   99    A max = std::numeric_limits<A>::max();
 
  100    A min = std::numeric_limits<A>::min();
 
  101    A high = (n > size_t(max)) ? max : A(n);
 
  102    A low = (n > size_t(-min)) ? min : A(-n);
 
  114    static const bool booleans[] = { 
true, 
false };
 
  115    out = oneOf<bool>(&booleans[0], &booleans[2]);
 
  133    static const char *basicChars = 
"ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789" 
  134       "abcdefghijklmnopqrstuvwxyz";
 
  135    if (n < 
sizeof (basicChars) - 1)
 
  136       out = oneOf<char>(&basicChars[0], &basicChars[n]);
 
  146 static inline void generate(
size_t n, 
unsigned char& out)
 
  150    out = 
static_cast<unsigned char>(c);
 
  161    out = generateInteger<short>(n);
 
  170 static inline void generate(
size_t n, 
unsigned short& out)
 
  172    out = generateInteger<unsigned short>(n);
 
  183    out = generateInteger<int>(n);
 
  192 static inline void generate(
size_t n, 
unsigned int& out)
 
  194    out = generateInteger<unsigned int>(n);
 
  205    out = generateInteger<long>(n);
 
  214 static inline void generate(
size_t n, 
unsigned long& out)
 
  216    out = generateInteger<unsigned long>(n);
 
  227    out = float(rand()) / float(RAND_MAX) * 2 * float(n) - float(n);
 
  238    out = double(rand()) / RAND_MAX * 2 * double(n) - double(n);
 
  247 static inline void generate(
size_t n, 
long double& out)
 
  249    out = 
static_cast<long double>(rand()) / RAND_MAX * 2 * n - n;
 
  265    for (
size_t i = 0; i < len; ++i) {
 
  274 #endif // !QUICKCHECK_GENERATE_H