Made random data generation generic.#102
Conversation
Also switched to using std::generate_n to fill vectors instead of a for loop.
|
@cbsmith Thanks. |
|
Hrm... not sure why the build failures are occurring. I'll take a look at this later tonight. |
| template<typename T> | ||
| void _genDataRandom(std::vector<T>& v, uint32_t values) { | ||
| v.clear(); | ||
| std::mt19937_64 e2(123456); |
There was a problem hiding this comment.
Not related to the PR, but the test might have discovered some hidden issues if it didn't use fixed seed. Perhaps, using device_random or time to seed generator and then, saving the seed is a better approach: If a test fails, then it should report the seed to be able to repro the test case.
There was a problem hiding this comment.
That seems like a good suggestion.
There was a problem hiding this comment.
I agree that it is most helpful to use fixed seeds.
| void _genDataRandom(std::vector<T>& v, uint32_t values) { | ||
| v.clear(); |
There was a problem hiding this comment.
| void _genDataRandom(std::vector<T>& v, uint32_t values) { | |
| v.clear(); | |
| void _genDataRandom(std::vector<T>& v, size_t valuesCount) { | |
| v.resize(valuesCount); |
There was a problem hiding this comment.
Yeah, I realized this just now as I got a chance to look at this again. I'm kind of surprised the tests passed on my own machine though. A little freaky.
|
Fixed the vector sizing error. Tests should pass now. |
|
Running tests now. |
|
Merging. |
Per discussion, making this a separate pull request.