Prolem with std::random_device and generation of section names
- Dominant language
- C++
- Stars
- 21.5k
- Forks
- 3.5k
- Avg merge
- 3d 16h
- Merged PRs (30d)
- 2
Description
## Description
I have a test that includes many randomized inputs. I wanted to trace them by including the randomization seed in a section name. The result is that the generated name completely misbehave if I use std::random_device to generate seeds, etc., while if I use pseudo-random generator things seem OK.
### Steps to reproduce
`TEST_CASE("Test random section name")`
`{`
` //std::random_device randomSource;`
` std::mt19937 randomSource(100);`
` std::uniform_int_distribution generator;`
` std::vector numbers;`
` for (size_t i = 0; i < 5; i++)`
` {`
` numbers.push_back(generator(randomSource));`
` }`
` for (size_t i = 0; i < 5; i++)`
` {`
` size_t number = numbers[i];`
` SECTION("Testing random number " + std::to_string(number))`
` {`
` std::cout << "Testing " << number << std::endl;`
` SUCCEED("Succeessful");`
` }`
` }`
`}`
``
As written, this test succeeds with 5 pseudo-random numbers. However, replacing `randomSource` with a `std::random_device` makes an infinite loop.
There were multiple other issues when I used std::random_device, but this is the easiest to explain and the immediate need I have.
### Extra information
* Catch version: **2.2.3**
* Operating System: [from uname -a] **Linux ubuntu 4.15.0-29-generic #31~16.04.1-Ubuntu SMP Wed Jul 18 08:54:04 UTC 2018 x86_64 x86_64 x86_64 GNU/Linux**
* Compiler+version: **gcc-4.9.4**
Contributor guide
Assessment
This issue has not been assessed yet.