scalometer/include/utils.hpp

17 lines
353 B
C++
Raw Normal View History

2024-12-13 00:33:08 +01:00
#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