95
you are viewing a single comment's thread
view the rest of the comments
[-] kleeon@hexbear.net 67 points 2 days ago

the simulation in question:

for (int i = 0; i < 80000; i++) {
   if (rand() % 2 == 0) {
      printf("Kamala wins\n");
   }
   else {
      printf("Trump wins\n");
   }
}
[-] Thordros@hexbear.net 25 points 2 days ago

This is much cleaner than mine that I did in python.

[-] kleeon@hexbear.net 39 points 2 days ago

thanks. Nate Silver paid me $50k to write this

[-] carpoftruth@hexbear.net 13 points 2 days ago

could you please input that into chatgpt so it will give me a summary of the code output? I'm a busy data driven guy so I don't have time for the details. however, I do have time for this post

[-] SSJ3Marx@hexbear.net 12 points 2 days ago

Hey! I understood that! That Python class must've taught me something after all.

[-] merthyr1831@lemmy.ml 8 points 2 days ago

huh, the sync for Lemmy code block renderer doesn't show the \ even within the code block 👁️👁️

[-] plinky@hexbear.net 8 points 2 days ago* (last edited 2 days ago)

Seems lots of unnecessary mods tbh,

S=0

for i in 1:80000

S+=rand()

end

ceil(S)

[-] naom3@hexbear.net 6 points 2 days ago

Modding by 2 is just a bitwise operation tho

[-] plinky@hexbear.net 2 points 2 days ago* (last edited 2 days ago)

Gotta dump results in some accumulate tho, and if then logic might be eh (although with branch prediction it might be auto 2 threads actually soviet-hmm or similar utilization at least)

[-] DaPorkchop_@lemmy.ml 2 points 2 days ago

A reasonable compiler could optimize this into a bitwise AND, load the pointer to the appropriate string constant into a register branchlessly using a lookup table or cmov instruction, and then execute a single call to printf.

[-] plinky@hexbear.net 1 points 2 days ago* (last edited 2 days ago)

I mean if I want to know the precise number, like 40012 or whatever. Obviously single call is fast, but printf of 40000 strings single strings is meh. I mean in my variant I don’t run comparison, even bitwise, just 80000 rand and sum, single ceil and print

[-] Hexboare@hexbear.net 7 points 2 days ago

I'm guessing it literally is a few lines in R, plugging in the polling data after running it through a "model" (i.e. tinkering with the variables based on how polls have historically translated into votes)

this post was submitted on 05 Nov 2024
95 points (99.0% liked)

The Dredge Tank

259 readers
536 users here now

The Dredge Tank. For posting all the low tier reactionary bullshit that you can't post anywhere else. Got some bullshit from Reddit with 2 upvotes and want to share, post it here.

This community was created with the purpose that Rule 8 fans will just block it.

The rules are literally The Dunk Tank's rules, just without rule 8.

Rule 1: All posts must include links to the subject matter, and no identifying information should be redacted.

Rule 2: If your source is a reactionary website, please use archive.is instead of linking directly.

Rule 3: No sectarianism.

Rule 4: TERF/SWERFs Not Welcome

Rule 5: No ableism of any kind (that includes stuff like libt*rd)

Rule 6: Do not post fellow hexbears.

Rule 7: Do not individually target other instances' admins or moderators.

founded 2 months ago
MODERATORS