56 template < GUM_Numeric GUM_SCALAR >
60 if (n == std::numeric_limits< Size >::max()) {
66 std::vector< GUM_SCALAR > v(n + 1);
67 std::vector< GUM_SCALAR > res(n);
68 v[0] = (GUM_SCALAR)0.0;
69 v[n] = (GUM_SCALAR)1.0;
70 for (
Idx i = 1; i < n; i++) {
73 std::sort(v.begin(), v.end());
75 for (
Idx i = 0; i < n; i++) {
76 res[i] = v[i + 1] - v[i];
82 template <
typename GENERATOR >
84 std::uniform_int_distribution< Idx > uni_int(0, max - 1);
85 return uni_int(generator);
Exception : out of bound.
#define GUM_ERROR(type, msg)
std::size_t Size
In aGrUM, hashed values are unsigned long int.
Size Idx
Type for indexes.
Idx randomValue(const Size max=2)
Returns a random Idx between 0 and max-1 included.
double randomProba()
Returns a random double between 0 and 1 included (i.e.
std::vector< GUM_SCALAR > randomDistribution(Size n)
Return a random discrete distribution.
gum is the global namespace for all aGrUM entities
Contains useful methods for random stuff.