18 #define RNGTEST_VERSION \ 19 "RNGTEST V1.0 test random number generator module" 22 #include <tfxx/commandline.h> 43 cout <<
"RNG parameters:\n" 44 <<
" type: " << rng.
type() <<
"\n" 45 <<
" seed: " << rng.
seed() <<
"\n" 46 <<
" mean: " << rng.
mean() <<
"\n" 47 <<
" std: " << rng.
std() << endl;
52 int main(
int iargc,
char* argv[])
59 "usage: rngtest [-l] [-v] [-t type] [-seed v] [-mean v]\n" 60 " [-std v] [-n n] [run]\n" 61 " or: rngtest --help|-h" "\n" 62 " or: rngtest --xhelp" "\n" 68 "--xhelp print comments regarding GSL RNG implementation\n" 70 "run run the program\n" 71 "-l print list of random number generators and exit\n" 73 "-t type select random number generator of type \"type\"\n" 74 " use option -l for a list of available types\n" 75 " type \"default\" will make selection based on\n" 76 " environment variables\n" 77 "-seed v initialize RNG with seed value v\n" 78 "-mean v set mean value\n" 79 "-std v set standard deviation\n" 80 "-n n print n random numbers\n" 82 "In case of no type selected or type set to \"default\" type\n" 83 "and seed value can be specified through environment variables.\n" 86 "GSL_RNG_TYPE=ranlux GSL_RNG_SEED=125 rngtest -v run\n" 117 cerr << usage_text << endl;
127 cerr << usage_text << endl;
128 cerr << help_text << endl;
156 cout <<
"Parameters specified on command line (maybe default):\n" 157 <<
" type: " << opt.
type <<
"\n" 158 <<
" mean: " << opt.
mean <<
"\n" 159 <<
" std: " << opt.
std <<
"\n" 163 cout <<
" seed: " << opt.
seed << endl;
167 cout <<
" no seed value specified" << endl;
176 cout <<
"\nRandom numbers:" << endl;
179 cout << i <<
" " << rng.value() << endl;
182 cout << endl <<
"set new seed" << endl;
186 cout <<
"\nRandom numbers:" << endl;
189 cout << i <<
" " << rng.value() << endl;
int int_arg(const int &iopt) const
return argument of option # iopt as int value
option requires an argument
bool optset(const int &iopt) const
true if option # iopt was set on commandline
double double_arg(const int &iopt) const
return argument of option # iopt as double value
double mean() const
return mean
unsigned long int seed() const
return last seed value
std::string type() const
return type of random number generator
long long_arg(const int &iopt) const
return argument of option # iopt as long value
int main(int iargc, char *argv[])
static void rng_list_types(std::ostream &os)
print list of random number generators to stream.
void report(const tfxx::numeric::RNGgaussian &rng)
Namespace containing all components of module commandline. ,.
Evaluates commandline by calling long_getopt. ,You may instantiate a Commandline object by passing th...
Provide random numbers with Gaussian distribution.This class is an interface to the GSL random number...
static const char * comment_gsl_rng_ranlux
comment on GSL RNGs
double std() const
return standard deviation
struct to define options ,This struct is used to define a list of options. An example is: ...
std::string string_arg(const int &iopt) const
return argument of option # iopt as string value
void set(const unsigned long int &seed)
feed with seed value