aGrUM  0.16.0
utils_random.h
Go to the documentation of this file.
1 
30 #ifndef GUM_UTILS_RANDOM_H
31 #define GUM_UTILS_RANDOM_H
32 
33 #include <chrono>
34 #include <cstdlib>
35 #include <ctime>
36 #include <iostream>
37 #include <numeric>
38 #include <random>
39 #include <utility>
40 #include <vector>
41 
42 #include <agrum/agrum.h>
43 
44 namespace gum {
45 
48 
54  Idx randomValue(const Size max = 2);
55 
60  double randomProba();
61 
68  template < typename GUM_SCALAR >
69  std::vector< GUM_SCALAR > randomDistribution(Size n);
70 
75  unsigned int randomGeneratorSeed();
76 
80  void initRandom(unsigned int seed = 0);
81 
85  std::default_random_engine getRandomGenerator(unsigned int seed = 0);
86 
88 } /* namespace gum */
89 
90 #ifndef GUM_NO_INLINE
92 #endif // GUM_NO_INLINE
93 
94 // always include the template implementations
96 
97 #endif /* GUM_UTILS_RANDOM_H */
std::vector< GUM_SCALAR > randomDistribution(Size n)
Return a random discrete distribution.
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.
Copyright 2005-2019 Pierre-Henri WUILLEMIN et Christophe GONZALES (LIP6) {prenom.nom}_at_lip6.fr.
Definition: agrum.h:25
unsigned int randomGeneratorSeed()
Returns the aGrUM&#39;s seed used by the std::generators.
void initRandom(unsigned int seed=0)
Initialize random generator seed.
Copyright 2005-2019 Pierre-Henri WUILLEMIN et Christophe GONZALES (LIP6) {prenom.nom}_at_lip6.fr.
std::default_random_engine getRandomGenerator(unsigned int seed)
define a random_engine with correct seed
Copyright 2005-2019 Pierre-Henri WUILLEMIN et Christophe GONZALES (LIP6) {prenom.nom}_at_lip6.fr.
std::size_t Size
In aGrUM, hashed values are unsigned long int.
Definition: types.h:48