/** * Clayton Cafiero * 2020-Jun-22 * Hide some implementation details here * randPopulateArray() * * The behavior of code here is not something we'll * cover in class and is not anything you'll be tested on. * You may ignore this file. */ #ifndef RANDI_H #define RANDI_H #include #include std::random_device rd; // Used to get a seed for rn generator std::mt19937 gen(rd()); // Mersenne twister seeded with rd() /** * Populate an array with size random integers between -range and range * @param a * @param size * @param range */ void randPopulateArray(std::vector &a, int size, int range) { std::uniform_int_distribution<> distrib(-range, range); for (int i = 0; i < size; ++i) { int num = distrib(gen); a.push_back(num); } } #endif //MAXSUBSUM_RANDI_H