this post was submitted on 05 Dec 2024
227 points (93.2% liked)

Science Memes

11442 readers
1764 users here now

Welcome to c/science_memes @ Mander.xyz!

A place for majestic STEMLORD peacocking, as well as memes about the realities of working in a lab.



Rules

  1. Don't throw mud. Behave like an intellectual and remember the human.
  2. Keep it rooted (on topic).
  3. No spam.
  4. Infographics welcome, get schooled.

This is a science community. We use the Dawkins definition of meme.



Research Committee

Other Mander Communities

Science and Research

Biology and Life Sciences

Physical Sciences

Humanities and Social Sciences

Practical and Applied Sciences

Memes

Miscellaneous

founded 2 years ago
MODERATORS
 
you are viewing a single comment's thread
view the rest of the comments
[โ€“] ptz@dubvee.org 40 points 3 weeks ago* (last edited 2 weeks ago) (3 children)

Hey, I like a little chaos in my codebase ๐Ÿ˜†

const funsies = () => (Math.round(Math.random() * 1000) % 2 == 0)
if ( condition || funsies() ) {
    // do the thing
}
[โ€“] sorrybookbroke@sh.itjust.works 6 points 3 weeks ago* (last edited 2 weeks ago) (1 children)

Wait, why the the *1000 or mod 2? Won't that give a 50\50 chance or the same as Math.round(Math.random).

No shade, and I may be wrong myself I am very tired

Probably to make the fractional random value between 0 and 1 to become an integer so that you can divisibility check for even with mod 2

[โ€“] modality@lemmy.myserv.one 4 points 3 weeks ago (1 children)
[โ€“] ptz@dubvee.org 19 points 3 weeks ago* (last edited 3 weeks ago)

Nope. I'm staunchly against "AI". If the code sucks, it's because I wrote bad code.

Edit: Oh, or did you mean is that how "AI" works?