aura

joined 1 month ago
[–] aura@lemmy.dbzer0.com 10 points 1 month ago (1 children)

it's not exactly the formula i posted but the principle is kinda the same

if u see it like this:

let min = 1
let max = 100
let random = Math.floor(Math.random() * (max - min + 1)) + min

the diff is that it's inclusive of max (bc of +1) and it always returns an integer (bc of Math.floor)

btw not defending this abomination of a man in javascript language or anything lol

[–] aura@lemmy.dbzer0.com 12 points 1 month ago (4 children)

that is common usage to get a random number between two values in JS. as unintuitive as it looks it's just more maintainable like that, the code was prolly just minified

Math.random() * (max - min) + min

https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math/random#getting_a_random_integer_between_two_values

[–] aura@lemmy.dbzer0.com 1 points 1 month ago
  • shut down all my senses by closing my eyes and lying down for at least 10min like i'm in some sort of isolation tank. it's super under-stimulating tho so depending on what overwhelmed me it won't work
  • shower, warm then cold. i like the transition / ritual, it's simpler than a workout and almost just as effective
  • try to solve someone else's problem (if they're okay with it) to regain some sense of control
  • watch what sb else is doing to regain perspective, especially kids, dogs, birds doing their thing. sometimes i just look out the window, my view is interesting
[–] aura@lemmy.dbzer0.com 1 points 1 month ago

whisper of the heart (1995) and spirited away (2001)

when i feel a little lost and lacking courage. a comfort / hopeful / nostalgia thing