13#ifndef ARCANE_CORE_RANDOM_UNIFORM01_H
14#define ARCANE_CORE_RANDOM_UNIFORM01_H
18#include "arcane/utils/FatalErrorException.h"
20#include "arcane/core/random/RandomGlobal.h"
25namespace Arcane::random
60template <
class UniformRandomNumberGenerator>
65 typedef UniformRandomNumberGenerator base_type;
66 typedef Real result_type;
67 static const bool has_fixed_range =
false;
69 explicit Uniform01(base_type& rng)
91 Real rng_val = _apply(_rng, _rng());
92 for (
int x = 0; x < 100; ++x) {
95 rng_val = _apply(_rng, _rng());
106 static ARCANE_DEPRECATED_122
Real apply(
const base_type& _rng,
typename base_type::result_type rng_val)
108 Real r = _apply(_rng, rng_val);
112 return (1.0 - 1.0e-10);
121 static Real _apply(
const base_type& _rng,
typename base_type::result_type rng_val)
123 return static_cast<Real>(rng_val - _rng.min()) /
124 (
static_cast<Real>(_rng.max() - _rng.min()) +
125 (std::numeric_limits<base_result>::is_integer ? 1.0 : 0.0));
130 typedef typename base_type::result_type base_result;
double Real
Type representing a real number.