c++ Thread Example

In this c++ thread example, we wrap a class object in a thread and execute it while running a loop from the main thread. std::thread myThread(ShowMeTheThread());...myThread.join() // Why wrap a process or class in a c++ thread? Generally, we would run a method or class in a thread when it either has a long running task or when something is going to probably stop it which if it were run in the...
Read More

C++ Random Generator

True c++ random number generators for computers are difficult to come by, but one that will suit most intents and purposes can be found here. The function searched for by most frequently by c++ random or c++ srand time . #include <ctime>srand(time(0)); // seed the random number generator with your clockint x = rand() % 15 + 1; // Numbers from 1 to 15Do not use for real money casino games...
Read More
Top