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

add floor, ceil, trunc, round

This commit is contained in:
bolero-MURAKAMI 2012-07-05 00:09:44 +09:00
parent c6fb8af0c5
commit 77f058a34c
12 changed files with 236 additions and 11 deletions

View file

@ -1,12 +1,12 @@
#ifndef SPROUT_RANDOM_GEOMETRIC_DISTRIBUTION_HPP
#define SPROUT_RANDOM_GEOMETRIC_DISTRIBUTION_HPP
#include <cmath>
#include <ios>
#include <limits>
#include <stdexcept>
#include <sprout/config.hpp>
#include <sprout/math/log.hpp>
#include <sprout/math/floor.hpp>
#include <sprout/random/random_result.hpp>
#include <sprout/random/uniform_01.hpp>
@ -98,7 +98,7 @@ namespace sprout {
template<typename Engine, typename Random>
SPROUT_CONSTEXPR sprout::random::random_result<Engine, geometric_distribution> generate_1(Random const& rnd) const {
using sprout::log;
using std::floor;
using sprout::floor;
return sprout::random::random_result<Engine, geometric_distribution>(
static_cast<IntType>(floor(log(RealType(1) - rnd.result()) / log_1mp_)),
rnd.engine(),