randome int cpp code example
Example 1: c++ random
#include <cstdlib>
#include <iostream>
#include <ctime>
int main()
{
std::srand(std::time(nullptr)); // use current time as seed for random generator
int random_variable = std::rand();
std::cout << "Random value on [0 " << RAND_MAX << "]: "
<< random_variable << '\n';
}
Example 2: c++ random int troll
#include <ctime>
#define true time(NULL) % 100 != 0