SPROUT_CONSTEXPR sprout::random::detail::generate_uniform_real_result<T, Engine> generate_uniform_real_false_1(
				sprout::random::random_result<Engine> const& rnd,
				T min_value,
				T max_value
				)
			{
				return sprout::random::detail::generate_uniform_real_false_2(
					rnd.engine(),
					min_value,
					max_value,
					static_cast<T>(rnd.result() - rnd.engine().min()),
					static_cast<T>(rnd.engine().max() - rnd.engine().min())
					);
			}
			SPROUT_CONSTEXPR sprout::random::detail::generate_uniform_real_result<T, Engine> generate_uniform_real_true_1(
				sprout::random::random_result<Engine> const& rnd,
				T min_value,
				T max_value
				)
			{
				typedef typename Engine::result_type base_result;
				return sprout::random::detail::generate_uniform_real_true_2(
					rnd.engine(),
					min_value,
					max_value,
					static_cast<T>(sprout::random::detail::subtract<base_result>()(rnd.result(), rnd.engine().min())),
					static_cast<T>(sprout::random::detail::subtract<base_result>()(rnd.engine().max(), rnd.engine().min())) + 1
					);
			}
Esempio n. 3
0
 SPROUT_CONSTEXPR sprout::random::random_result<Engine, uniform_01> generate(
     Engine const& eng,
     sprout::random::random_result<Engine> const& rnd
 ) const
 {
     typedef typename Engine::result_type base_result;
     return generate_1(
                eng,
                rnd,
                result_type(rnd.result() - eng.min()) * (
                    result_type(1) / (
                        result_type(eng.max() - eng.min()) + result_type(
                            std::numeric_limits<base_result>::is_integer ? 1 : 0
                        )
                    )
                )
            );
 }