scalometer/include/utils.hpp

17 lines
341 B
C++

#ifndef UTILS_HPP
#define UTILS_HPP
#include <random>
// Function to initialize a vector with random numbers
void initialize_vector(std::vector<float>& v) {
std::random_device rd;
std::mt19937 gen(rd());
std::uniform_real_distribution<float> dis(0.0f, 1.0f);
for (auto& elem : v) {
elem = dis(gen);
}
}
#endif // UTILS_HPP