tatterdemalion@programming.dev to Science Memes@mander.xyzEnglish · 22 days agoif statement == falsei.imgflip.comimagemessage-square35fedilinkarrow-up11arrow-down10
arrow-up11arrow-down1imageif statement == falsei.imgflip.comtatterdemalion@programming.dev to Science Memes@mander.xyzEnglish · 22 days agomessage-square35fedilink
minus-squareAdmiral Patrick@dubvee.orglinkfedilinkEnglisharrow-up0·edit-222 days agoHey, I like a little chaos in my codebase 😆 let funsies = (Math.round(Math.random() * 1000) % 2 == 0) if (condition || funsies) { // do the thing }
minus-squareAdmiral Patrick@dubvee.orglinkfedilinkEnglisharrow-up0·edit-222 days agoNope. 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?
minus-squaresorrybookbroke@sh.itjust.workslinkfedilinkEnglisharrow-up0·22 days agoWait, 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
minus-squaremexicancartel@lemmy.dbzer0.comlinkfedilinkEnglisharrow-up0·21 days agoProbably 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
Hey, I like a little chaos in my codebase 😆
let funsies = (Math.round(Math.random() * 1000) % 2 == 0) if (condition || funsies) { // do the thing }
is this AI?
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?
Wait, 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