29 inline T
u(T min, T max)
31 static thread_local std::mt19937 generator(static_cast<unsigned int>(clock() + std::hash<std::thread::id>()(std::this_thread::get_id())));
32 std::uniform_int_distribution<T> distribution(min, max);
33 return distribution(generator);
46 inline T
U(T min = 0, T max = 1)
48 static thread_local std::mt19937 generator(static_cast<unsigned int>(clock() + std::hash<std::thread::id>()(std::this_thread::get_id())));
49 std::uniform_real_distribution<T> distribution(min, max);
50 return distribution(generator);
63 inline T
N(T mu = 0, T sigma = 1)
65 static thread_local std::mt19937 generator(static_cast<unsigned int>(clock() + std::hash<std::thread::id>()(std::this_thread::get_id())));
66 std::normal_distribution<T> distribution(mu, sigma);
67 return distribution(generator);
79 inline Mat
U(cv::Size size,
int type,
double min = 0,
double max = 1)
81 static thread_local RNG rng(static_cast<unsigned int>(clock() + std::hash<std::thread::id>()(std::this_thread::get_id())));
83 rng.fill(res, RNG::UNIFORM, min, max);
94 inline Mat
N(cv::Size size,
int type,
double mu = 0,
double sigma = 1)
96 static thread_local RNG rng(static_cast<unsigned int>(clock() + std::hash<std::thread::id>()(std::this_thread::get_id())));
98 rng.fill(res, RNG::NORMAL, mu, sigma);
T U(T min=0, T max=1)
Returns a floating-point random number with uniform distribution.
T u(T min, T max)
Returns an integer random number with uniform distribution.
T N(T mu=0, T sigma=1)
Returns a floating-point random number with normal distribution.