Arthur Besse@lemmy.ml to Programmer Humor@lemmy.mlEnglish · edit-21 day agoIncredible stochastic algorithm, gets more reliable the larger your input, incredibly fast, trivial to implement and deterministic on its inputslemmy.mlimagemessage-square28linkfedilinkarrow-up1328arrow-down14file-text
arrow-up1324arrow-down1imageIncredible stochastic algorithm, gets more reliable the larger your input, incredibly fast, trivial to implement and deterministic on its inputslemmy.mlArthur Besse@lemmy.ml to Programmer Humor@lemmy.mlEnglish · edit-21 day agomessage-square28linkfedilinkfile-text
cross-posted from: https://lemmy.blahaj.zone/post/38950495 https://cosocial.ca/@mhoye/116111505546606451
minus-squareanton@lemmy.blahaj.zonelinkfedilinkarrow-up6·1 day agoThe test suite probably looks something like this: int tests_passed=0; int tests_failed=0; for(int i=0;i<100000;i++){ printf("test no. %d: ", i); if(is_prime(i)==actually_is_prime(i)){ printf("passed\n"); tests_passed++; }else{ printf("failed\n"); tests_failed++; } } //...
minus-square/home/pineapplelover@lemmy.dbzer0.comlinkfedilinkarrow-up3·22 hours agoAh that makes more sense thanks. So the bottom one is a unit test and not the code being run itself
The test suite probably looks something like this:
int tests_passed=0; int tests_failed=0; for(int i=0;i<100000;i++){ printf("test no. %d: ", i); if(is_prime(i)==actually_is_prime(i)){ printf("passed\n"); tests_passed++; }else{ printf("failed\n"); tests_failed++; } } //...Ah that makes more sense thanks. So the bottom one is a unit test and not the code being run itself