#include <iostream>
#include <random>
#include <vector>


int main() {
	std::random_device rd;
    std::mt19937 gen(rd());
    std::uniform_real_distribution<> dis(0,1);
    
    // Use fifty-fifty coin tosses to set some booleans.
    // In actual code, these will be set by some condition.
	bool set_a = dis(gen) < 0.5;
    bool success = dis(gen) < 0.5;
    bool get_last = dis(gen) < 0.5;

    // Don't ever do this!
	int a = 0, b = 0;
	(set_a ? a : b) = 42;
    std::cout << "a=" << a << "  b=" << b << '\n';

    // On the other hand, there's nothing at all wrong with this.
    std::cout << "Status = " << (success ? "Success" : "Failure") << '\n';

    // There's nothing at all wrong with this, either.
    std::vector<int> buffer(42);
    int nlines = get_last ? 1 : buffer.size();
    std::cout << "nlines = " << nlines << '\n';

}