13#ifndef ARCANE_RANDOM_UNIFORMONSMALLINT_H
14#define ARCANE_RANDOM_UNIFORMONSMALLINT_H
18#include "arcane/utils/FatalErrorException.h"
20#include "arcane/random/NormalDistribution.h"
58template<
class UniformRandomNumberGenerator,
class IntType =
int>
63 typedef IntType result_type;
64 static const bool has_fixed_range =
false;
67 result_type operator()()
70 return ((_rng() - _rng.min()) / _factor) % _range + _min;
72 result_type min()
const {
return _min; }
73 result_type max()
const {
return _max; }
75 typedef typename base_type::result_type base_result;
82template<
class UniformRandomNumberGenerator,
class IntType>
85 : _rng(
rng), _min(min), _max(max),
86 _range(
static_cast<base_result>(_max-_min)+1), _factor(1)
92 base_result
r_base = _rng.max() - _rng.min();
93 if(
r_base == std::numeric_limits<base_result>::max()) {
98 if(r_base % _range == 0) {
100 _factor = r_base / _range;
103 for( ; r_base/_range/32 >= _range; _factor *= 2)
Lecteur des fichiers de maillage via la bibliothèque LIMA.