this post was submitted on 22 Feb 2026
213 points (98.6% liked)

Programmer Humor

41092 readers
311 users here now

Post funny things about programming here! (Or just rant about your favourite programming language.)

Rules:

founded 6 years ago
MODERATORS
all 27 comments
sorted by: hot top controversial new old
[–] Jankatarch@lemmy.world 2 points 45 minutes ago

...95.121%
???

[–] HiddenLayer555@lemmy.ml 4 points 1 hour ago

Just put "Precondition: x must not be prime" in the function doc and it'll be 100% accurate. Not my fault if you use it wrong.

[–] Armand1@lemmy.world 1 points 1 hour ago* (last edited 1 hour ago)

I said something similar here about an election fraud detection system with 99.999% accuracy.

https://lemmy.world/comment/22178379

[–] pruwybn@discuss.tchncs.de 6 points 6 hours ago (1 children)

Is this not at all stochastic, or do I just not know what stochastic means?

[–] cypherpunks@lemmy.ml 2 points 4 hours ago

it would be clearer to say that it is stochastically accurate

[–] pineapplelover@lemmy.dbzer0.com 7 points 8 hours ago (4 children)

I'm confused, shouldn't this be printing false no matter what the input is?

[–] Couldbealeotard@lemmy.world 3 points 1 hour ago

The output is not the output of the algorithm, it's the output of the unit test.

95% of numbers up to that point at not prime. Testing the algorithm that only says "not prime" is therefore correct 95% of the time. The joke is that, similar to AI, the algorithm is being presented as a useful tool because it's correct often but not always.

[–] Carl@hexbear.net 12 points 7 hours ago* (last edited 7 hours ago)

that's the joke, since most numbers aren't prime, this function is technically highly accurate despite being completely useless.

[–] anton@lemmy.blahaj.zone 3 points 6 hours ago

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++;
    }
}
//...
[–] MeetMeAtTheMovies@hexbear.net 6 points 7 hours ago

Warning: unused variable

Just add it to the pile I guess

[–] rbos@lemmy.ca 5 points 7 hours ago

I've had managers who follow that exact algorithm.

[–] Thekingoflorda@lemmy.world 10 points 10 hours ago

It approaches 100% accuracy

[–] sepiroth154@feddit.nl 17 points 12 hours ago* (last edited 11 hours ago) (1 children)

You could simplify it even further by removing the int x parameter of the function...

[–] obelisk_complex@piefed.ca 10 points 11 hours ago

So elegant! This is too valuable for GitHub, sell this directly to the Saudi government.

[–] TomMasz@lemmy.world 21 points 12 hours ago

95.121% of the time it works everytime.

[–] Evotech@lemmy.world 1 points 6 hours ago (1 children)
[–] Jankatarch@lemmy.world 1 points 41 minutes ago* (last edited 39 minutes ago)

"AI models have started training other AI models, by pressing The-Button-That-Trains-AI-models; this button was built 7 years ago by a bunch of online volunteers we won't ever credit."

[–] idriss@lemmy.ml 20 points 13 hours ago (2 children)

I am screenshoting this so it will be screenshot of a screenshot of a screenshot then post it somewhere else

[–] SharkAttak@kbin.melroy.org 6 points 9 hours ago

Not even adding some watermark? smh

[–] athatet@lemmy.zip 1 points 6 hours ago
[–] razen@lemmy.world 4 points 9 hours ago (2 children)

But when the input is all prime numbers then the accuracy is 0.

[–] cypherpunks@lemmy.ml 5 points 9 hours ago

The Simpsons character Rainier Wolfcastle on stage with a microphone, on TV, with the caption "THAT'S THE JOKE"

also btw icymi, this is a post about LLMs

[–] lnxtx@sopuli.xyz 2 points 12 hours ago

But cryptography...