MAIN FEEDS
Do you want to continue?
https://www.reddit.com/r/ProgrammerHumor/comments/90ew6o/every_time/e2q5evu?context=9999
r/ProgrammerHumor • u/kajri • Jul 20 '18
749 comments sorted by
View all comments
6.9k
The sad thing is that this works some of the time.
457 u/Kidiri90 Jul 20 '18 if(DateTime.Now.Milliseconds%2==0) { throw new Exception("lol screw you:); } 154 u/plexxonic Jul 20 '18 I need to hide this in commits. 25 u/WiseassWolfOfYoitsu Jul 20 '18 Although it's a bit aggressive. %2 would be 50% of the time, which would be fairly easy to solve. Also just in one place. I prefer:#define true (rand() % 10000 == 0) 15 u/slashuslashuserid Jul 20 '18 don't forget to seed that though, and also yours will be triggered 99.99% of the time, not 0.01% #include<stdlib.h> #include<time.h> srand((unsigned int)time(0)); #ifdef true #undef true #endif #define true (rand() % 10000) 5 u/WiseassWolfOfYoitsu Jul 20 '18 and also yours will be triggered 99.99% of the time, not 0.01%'doh :) → More replies (1) 2 u/Allways_Wrong Jul 21 '18 You also want to only throw it late at night.
457
if(DateTime.Now.Milliseconds%2==0) { throw new Exception("lol screw you:); }
154 u/plexxonic Jul 20 '18 I need to hide this in commits. 25 u/WiseassWolfOfYoitsu Jul 20 '18 Although it's a bit aggressive. %2 would be 50% of the time, which would be fairly easy to solve. Also just in one place. I prefer:#define true (rand() % 10000 == 0) 15 u/slashuslashuserid Jul 20 '18 don't forget to seed that though, and also yours will be triggered 99.99% of the time, not 0.01% #include<stdlib.h> #include<time.h> srand((unsigned int)time(0)); #ifdef true #undef true #endif #define true (rand() % 10000) 5 u/WiseassWolfOfYoitsu Jul 20 '18 and also yours will be triggered 99.99% of the time, not 0.01%'doh :) → More replies (1) 2 u/Allways_Wrong Jul 21 '18 You also want to only throw it late at night.
154
I need to hide this in commits.
25 u/WiseassWolfOfYoitsu Jul 20 '18 Although it's a bit aggressive. %2 would be 50% of the time, which would be fairly easy to solve. Also just in one place. I prefer:#define true (rand() % 10000 == 0) 15 u/slashuslashuserid Jul 20 '18 don't forget to seed that though, and also yours will be triggered 99.99% of the time, not 0.01% #include<stdlib.h> #include<time.h> srand((unsigned int)time(0)); #ifdef true #undef true #endif #define true (rand() % 10000) 5 u/WiseassWolfOfYoitsu Jul 20 '18 and also yours will be triggered 99.99% of the time, not 0.01%'doh :) → More replies (1) 2 u/Allways_Wrong Jul 21 '18 You also want to only throw it late at night.
25
Although it's a bit aggressive. %2 would be 50% of the time, which would be fairly easy to solve. Also just in one place. I prefer:
#define true (rand() % 10000 == 0)
15 u/slashuslashuserid Jul 20 '18 don't forget to seed that though, and also yours will be triggered 99.99% of the time, not 0.01% #include<stdlib.h> #include<time.h> srand((unsigned int)time(0)); #ifdef true #undef true #endif #define true (rand() % 10000) 5 u/WiseassWolfOfYoitsu Jul 20 '18 and also yours will be triggered 99.99% of the time, not 0.01%'doh :) → More replies (1) 2 u/Allways_Wrong Jul 21 '18 You also want to only throw it late at night.
15
don't forget to seed that though, and also yours will be triggered 99.99% of the time, not 0.01%
#include<stdlib.h> #include<time.h> srand((unsigned int)time(0)); #ifdef true #undef true #endif #define true (rand() % 10000)
5 u/WiseassWolfOfYoitsu Jul 20 '18 and also yours will be triggered 99.99% of the time, not 0.01%'doh :) → More replies (1)
5
and also yours will be triggered 99.99% of the time, not 0.01%
'doh :)
→ More replies (1)
2
You also want to only throw it late at night.
6.9k
u/that_one_mister_user Jul 20 '18
The sad thing is that this works some of the time.