67 #include <visp3/core/vpConfig.h>
69 #if defined(_MSC_VER) && (_MSC_VER < 1700)
70 typedef unsigned __int64 uint64_t;
71 typedef unsigned __int32 uint32_t;
76 #if (VISP_CXX_STANDARD > VISP_CXX_STANDARD_11)
130 vpUniRand(uint64_t seed, uint64_t seq = 0x123465789ULL);
135 int uniform(
int a,
int b);
136 float uniform(
float a,
float b);
137 double uniform(
double a,
double b);
138 void setSeed(uint64_t initstate, uint64_t initseq);
149 inline static std::vector<T>
shuffleVector(
const std::vector<T> &inputVector,
const int32_t &seed = -1)
151 std::vector<T> shuffled = inputVector;
152 #if (VISP_CXX_STANDARD <= VISP_CXX_STANDARD_11)
157 std::srand(std::time(0));
159 std::random_shuffle(shuffled.begin(), shuffled.end());
162 std::shuffle(shuffled.begin(), shuffled.end(), std::mt19937 { std::random_device{}() });
165 std::shuffle(shuffled.begin(), shuffled.end(), std::mt19937 { static_cast<uint32_t>(seed) });
172 struct vpPcgStateSetSeq64t
178 vpPcgStateSetSeq64t(uint64_t state_ = 0x853c49e6748fea9bULL, uint64_t inc_ = 0xda3e39cb94b95bdbULL)
179 : state(state_), inc(inc_)
182 typedef struct vpPcgStateSetSeq64t pcg32_random_t;
185 uint32_t boundedRand(uint32_t bound);
189 pcg32_random_t m_rng;
Class for generating random numbers with uniform probability density.
static std::vector< T > shuffleVector(const std::vector< T > &inputVector, const int32_t &seed=-1)
Create a new vector that is a shuffled version of the inputVector.