1
0
Fork 0
mirror of https://github.com/bolero-MURAKAMI/Sprout synced 2025-08-03 12:49:50 +00:00

fix random generation implementation

This commit is contained in:
bolero-MURAKAMI 2014-01-16 01:04:31 +09:00
parent 406a1ff789
commit 3879666b02
18 changed files with 140 additions and 110 deletions

View file

@ -15,6 +15,7 @@
#include <sprout/math/floor.hpp>
#include <sprout/random/random_result.hpp>
#include <sprout/random/uniform_01.hpp>
#include <sprout/generator/functions.hpp>
#include <sprout/assert.hpp>
namespace sprout {
@ -90,8 +91,8 @@ namespace sprout {
template<typename Engine, typename Random>
SPROUT_CONSTEXPR sprout::random::random_result<Engine, geometric_distribution> generate_1(Random const& rnd) const {
return sprout::random::random_result<Engine, geometric_distribution>(
static_cast<IntType>(sprout::math::floor(sprout::math::log(RealType(1) - rnd.result()) / log_1mp_)),
rnd.engine(),
static_cast<IntType>(sprout::math::floor(sprout::math::log(RealType(1) - sprout::generators::generated_value(rnd)) / log_1mp_)),
sprout::generators::next_generator(rnd).engine(),
*this
);
}