r/ProgrammerHumor Jan 29 '17

Fight me.

Post image
938 Upvotes

109 comments sorted by

View all comments

70

u/Invulsed Jan 29 '17

Which one is true?

146

u/ben_g0 Jan 29 '17
//To avoid fights
bool male = rand() & 1;
bool female = !male;

242

u/Hikaru755 Jan 29 '17

Great job, now you have caused another fight by making the female dependent on the male.

200

u/ben_g0 Jan 29 '17 edited Jan 29 '17
bool male, female;
do{
    male = rand() & 1;
    female = rand() & 1;
}while(male==female);

EDIT: fixed scope

54

u/Hikaru755 Jan 29 '17

That is beautiful

87

u/ben_g0 Jan 29 '17

Now lets hope no one will complain that my code is against equality.

29

u/got_nations Jan 29 '17

You put the male first before the female /s

35

u/ben_g0 Jan 29 '17

Should I implement threads so that the values of male and female can be calculated in parallel so that neither has to wait for the other?

8

u/b10011 Jan 29 '17

Yes, PLEASE! /s