If performance is your only criterion, then the answer is:
bool get_random()
{
return true; // chosen by fair coin flip.
// guaranteed to be random.
}
Unfortunately, the entropy of this random number is zero, but the performance is quite fast.
Since I suspect that this random number generator is not very useful to you, you will need to quantify how random you want your booleans to be. How about a cycle length of 2048? One million? 2^19937-1? Until the end of the universe?
I suspect that, since you explicitly stated that performance is your utmost concern, then a good old fashioned linear congruential generator might be "good enough". Based on this article, I'm guessing that this generator's period is around 32*((2^31)-5), or about 68 trillion iterations. If that's not "good enough", you can drop in any C++11 compatible generator you like instead of minstd_rand.
For extra credit, and a small performance hit, modify the below code to use the biased coin algorithm to remove bias in the generator.
#include <iostream>
#include <random>
bool get_random()
{
typedef std::minstd_rand generator_type;
typedef generator_type::result_type result_type;
static generator_type generator;
static unsigned int bits_remaining = 0;
static result_type random_bits;
if ( bits_remaining == 0 )
{
random_bits = generator();
bits_remaining = sizeof( result_type ) * CHAR_BIT - 1;
}
return ( ( random_bits & ( 1 << bits_remaining-- ) ) != 0 );
}
int main()
{
for ( unsigned int i = 0; i < 1000; i++ )
{
std::cout << " Choice " << i << ": ";
if ( get_random() )
std::cout << "true";
else
std::cout << "false";
std::cout << std::endl;
}
}