this post was submitted on 05 Dec 2024
226 points (93.1% liked)

Science Memes

11397 readers
239 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
[โ€“] [email protected] 40 points 1 week ago* (last edited 1 week 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
}
[โ€“] [email protected] 5 points 1 week ago* (last edited 1 week 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

[โ€“] [email protected] 2 points 1 week ago

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

[โ€“] [email protected] 4 points 1 week ago (1 children)
[โ€“] [email protected] 19 points 1 week ago* (last edited 1 week 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?