uniformgen: + interval() method
This commit is contained in:
parent
fdefb286b0
commit
a449316999
1 changed files with 10 additions and 2 deletions
|
|
@ -12,11 +12,19 @@ namespace xo {
|
|||
public:
|
||||
using generator_type = generator<Engine, std::uniform_real_distribution<double>>;
|
||||
|
||||
template <class Engine>
|
||||
static generator_type unit(Engine eng) {
|
||||
/* named ctor idiom */
|
||||
template <class Eng>
|
||||
static generator_type unit(Eng eng) {
|
||||
return make_generator(std::move(eng),
|
||||
std::uniform_real_distribution<double>(0.0, 1.0));
|
||||
}
|
||||
|
||||
/* named ctor idiom */
|
||||
template <class Eng>
|
||||
static generator_type interval(Eng eng, double lo, double hi) {
|
||||
return make_generator(std::move(eng),
|
||||
std::uniform_real_distribution<double>(lo, hi));
|
||||
}
|
||||
};
|
||||
} /*namespace rng*/
|
||||
} /*namespace xo*/
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue