Why std::random_device generate non-deterministic random numbers? What is the seed in this generator? It's not a time, so what?
Asked
Active
Viewed 301 times
-1
-
1Kind of explained [here](https://stackoverflow.com/questions/39288595/why-not-just-use-random-device). Trying to find a better dupe. – NathanOliver Sep 13 '19 at 17:55
-
"If implementation limitations prevent generating nondeterministic random numbers, the implementation may employ a random number engine." [rand.device](http://eel.is/c++draft/rand.device#2) – Daniel Kamil Kozar Sep 13 '19 at 17:56
-
[wikipedia useful](https://en.wikipedia.org/wiki/Random_number_generation) – Ripi2 Sep 13 '19 at 17:59
-
`std::random_device` *should* generate non-deterministic values, but it doesn't have to. It depends on what the platform has to offer. – François Andrieux Sep 13 '19 at 18:00
-
On bad implementations, `std::random_device` can sometimes just be implemented to return the same sequence of numbers every time. See [this question](https://stackoverflow.com/questions/18880654/why-do-i-get-the-same-sequence-for-every-run-with-stdrandom-device-with-mingw). – François Andrieux Sep 13 '19 at 18:12
1 Answers
1
It is not specified. Implementation is supposed to provide suitable ways of doing this, and usually they would recourse to OS-provided tools.
For example, on Linux there are /dev/[u]random devices which will provide entropy from a system state.

SergeyA
- 61,605
- 5
- 78
- 137