random1actualColour = rand() % 2;
There are two problems with this approach. One is that the low order bits of the random number generator are not particularly random, so neither withwill random1actualColour
be. On my machine, there's a slight but measurable bias toward 0 with that. The second problem is that it's not thread safe because rand
stores hidden state. A better solution, if your compiler and library supports it, would be to use the C++11 `std::uniform_int_distribution. It looks complex, but it's actually pretty easy to use.