Python
- 19 ответов
- 0 вопросов
11
Вклад в тег
#include <random>
#include <iostream>
int main()
{
auto n = 9;
auto rnd = std::random_device{};
auto gen = std::mt19937_64{rnd()};
auto dis = std::uniform_real_distribution<double>{-0.1, 0.2};
auto res = std::vector<double>{};
std::generate_n(
std::inserter(res, std::end(res)),
n,
[&](){ return dis(gen); });
for (const auto& elem: res)
{
std::cout << elem << '\n';
}
}