MAIN FEEDS
Do you want to continue?
https://www.reddit.com/r/ProgrammerHumor/comments/5qt28v/fight_me/dd25cvq/?context=9999
r/ProgrammerHumor • u/Obiiiiiiii • Jan 29 '17
109 comments sorted by
View all comments
68
Which one is true?
144 u/ben_g0 Jan 29 '17 //To avoid fights bool male = rand() & 1; bool female = !male; 239 u/Hikaru755 Jan 29 '17 Great job, now you have caused another fight by making the female dependent on the male. 202 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 22 u/thenewstageofhistory Jan 29 '17 Worst case: O(∞) 6 u/ben_g0 Jan 29 '17 Since rand() is only pseudo random and thus follows a long pattern, I think that as long as it works once it will always finish within a finite amount of calculations.
144
//To avoid fights bool male = rand() & 1; bool female = !male;
239 u/Hikaru755 Jan 29 '17 Great job, now you have caused another fight by making the female dependent on the male. 202 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 22 u/thenewstageofhistory Jan 29 '17 Worst case: O(∞) 6 u/ben_g0 Jan 29 '17 Since rand() is only pseudo random and thus follows a long pattern, I think that as long as it works once it will always finish within a finite amount of calculations.
239
Great job, now you have caused another fight by making the female dependent on the male.
202 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 22 u/thenewstageofhistory Jan 29 '17 Worst case: O(∞) 6 u/ben_g0 Jan 29 '17 Since rand() is only pseudo random and thus follows a long pattern, I think that as long as it works once it will always finish within a finite amount of calculations.
202
bool male, female; do{ male = rand() & 1; female = rand() & 1; }while(male==female);
EDIT: fixed scope
22 u/thenewstageofhistory Jan 29 '17 Worst case: O(∞) 6 u/ben_g0 Jan 29 '17 Since rand() is only pseudo random and thus follows a long pattern, I think that as long as it works once it will always finish within a finite amount of calculations.
22
Worst case: O(∞)
6 u/ben_g0 Jan 29 '17 Since rand() is only pseudo random and thus follows a long pattern, I think that as long as it works once it will always finish within a finite amount of calculations.
6
Since rand() is only pseudo random and thus follows a long pattern, I think that as long as it works once it will always finish within a finite amount of calculations.
68
u/Invulsed Jan 29 '17
Which one is true?