It is a good sign, indeed, that you don't want to include all the Standard Library header files (via the appalling and non-standard #include <bits/stdc++.h>
concoction)! However, you do need to (explicitly) include the headers relevant to the aspects/components of the Standard Library that you actually use.
In the case of the std::random_device
class (and, also, the other two random-related classes that you use), you will need to include the header that defines those classes, with the following line:
#include <random>
Also, for the std::cout
(and related) classes, you will need #include <iostream>
.
As mentioned in the comments, the cppreference website is as good a place as any to get a quick guide to which header(s) you need to include for any of the std::xxxx
classes, although you will soon 'get to know' the relevant headers for the more common Standard Library classes.