maris@lemmy.world to Programmer Humor@programming.dev · 1 day agoGambling with Lainlemmy.worldimagemessage-square31fedilinkarrow-up1308arrow-down111
arrow-up1297arrow-down1imageGambling with Lainlemmy.worldmaris@lemmy.world to Programmer Humor@programming.dev · 1 day agomessage-square31fedilink
minus-squarer00ty@kbin.lifelinkfedilinkarrow-up5·1 day agoOh right. I thought it might work the same as range etc in python, where is does one less than you specify… Coming from, well every other language this really threw me off on my first python excursion.
minus-squareshape_warrior_t@programming.devlinkfedilinkEnglisharrow-up1·20 hours agoYou can get the exclusive behaviour with random.randrange. (Relevant Stack Overflow question with a somewhat interesting answer)
minus-squareChaoticNeutralCzech@feddit.orglinkfedilinkEnglisharrow-up1·1 day agoAny language… except MATLAB. Fuck MATLAB. (Their arrays even start at 1, what the fuck?!)
minus-squarewheezy@lemmy.mllinkfedilinkarrow-up2arrow-down1·edit-21 day agoLua starts at 1 too. It’s infuriating. I believe for the same historical reason Matlab does. Both meant for non CS people.
Oh right. I thought it might work the same as range etc in python, where is does one less than you specify… Coming from, well every other language this really threw me off on my first python excursion.
You can get the exclusive behaviour with
random.randrange
. (Relevant Stack Overflow question with a somewhat interesting answer)Any language… except MATLAB. Fuck MATLAB.
(Their arrays even start at 1, what the fuck?!)
Lua starts at 1 too. It’s infuriating. I believe for the same historical reason Matlab does.
Both meant for non CS people.