Download cpp source code

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
#include <cstdlib>
#include <iostream>

#include "UniformRandom.hpp"

#ifdef UNIFORM_RANDOM

// usage UniformRandom COUNT MIN MAX
int main(int argc, char* argv[]) {
  const int count = argc >= 2 ? std::atoi(argv[1]) : 1;
  const int min = argc >= 3 ? std::atoi(argv[2]) : 0;
  const int max = argc >= 4 ? std::atoi(argv[3]) : 100;

  // Generate a pseudo-random numbers
  UniformRandom<int> uniformRandom;
  for (int current = 0; current < count; ++current) {
    std::cout << uniformRandom.between(min, max) << std::endl;
  }
}

#endif