Content pfp
Content
@
0 reply
0 recast
0 reaction

Piter Pasma  pfp
Piter Pasma
@piterpasma
I want this question to have its own thread :-) What's your favourite function?
6 replies
0 recast
7 reactions

Infinity pfp
Infinity
@infinityproject
Inclusive rnd range. Math.floor(Math.random() * ((max-min)+1) + min - use it all the time
2 replies
0 recast
1 reaction

Piter Pasma  pfp
Piter Pasma
@piterpasma
omg 🤯 do you love off-by-one errors? fighting fence posts? do your arrays also start at one? (in which case you might like Lua!) ;-) but seriously don't you get loads of "+ 1" and "- 1" elsewhere in your code if you do this? if not, what do you use it for?
1 reply
0 recast
0 reaction

Piter Pasma  pfp
Piter Pasma
@piterpasma
Art Blocks also provides this function in their "Random" class and I maintain that it is the source of more bugs than whatever imagined ease of use. Like, walk me through, how do you pick randomly from a list, _without_ having to compensate for the extraneous "+1" in the function?
1 reply
0 recast
0 reaction