14 #ifndef __INCLUDED__SCOPIRA_TOOL_RANDOM_H__ 15 #define __INCLUDED__SCOPIRA_TOOL_RANDOM_H__ 20 #include <scopira/tool/object.h> 21 #include <scopira/tool/limits.h> 22 #include <scopira/tool/export.h> 49 double next_double(GEN &g,
double mx) {
return mx * (g() - g.min()) / (g.max() - g.min()); }
56 double next_double(GEN &g) {
return (g() - g.min()) / (g.max() - g.min()); }
70 typedef unsigned int result_type;
72 static const bool has_fixed_range =
true;
81 SCOPIRA_EXPORT
explicit sysdev_gen(
const std::string& token = default_token);
86 result_type
min(
void)
const {
return std::numeric_limits<result_type>::min(); }
88 result_type
max(
void)
const {
return std::numeric_limits<result_type>::max(); }
101 result_type
operator()(result_type mx) {
return (*
this)() % mx; }
104 static const char *
const default_token;
119 typedef int result_type;
121 static const bool has_fixed_range =
true;
122 static const int min_value = 0;
123 static const int max_value = RAND_MAX;
126 SCOPIRA_EXPORT
explicit sysrand_gen(
unsigned int seed0 = 1);
129 result_type
min(
void)
const {
return min_value; }
131 result_type
max(
void)
const {
return max_value; }
134 SCOPIRA_EXPORT
static void seed(
unsigned int seed0);
136 SCOPIRA_EXPORT
static result_type next(
void);
149 result_type
operator()(result_type mx) {
return (*
this)() % mx; }
163 typedef long int result_type;
165 static const bool has_fixed_range =
true;
166 static const int min_value = 0;
167 static const int max_value = RAND_MAX;
170 SCOPIRA_EXPORT
explicit sysrandom_gen(
unsigned int seed0 = 1);
173 result_type
min(
void)
const {
return min_value; }
175 result_type
max(
void)
const {
return max_value; }
178 SCOPIRA_EXPORT
static void seed(
unsigned int seed0);
180 SCOPIRA_EXPORT result_type next(
void);
193 result_type
operator()(result_type mx) {
return (*
this)() % mx; }
Definition: archiveflow.h:20