maris@lemmy.world to Programmer Humor@programming.dev · 21 days agoGambling with Lainlemmy.worldimagemessage-square21fedilinkarrow-up1202arrow-down19
arrow-up1193arrow-down1imageGambling with Lainlemmy.worldmaris@lemmy.world to Programmer Humor@programming.dev · 21 days agomessage-square21fedilink
minus-squarer00ty@kbin.lifelinkfedilinkarrow-up2·21 days 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-squareChaoticNeutralCzech@feddit.orglinkfedilinkEnglisharrow-up1·21 days agoAny language… except MATLAB. Fuck MATLAB. (Their arrays even start at 1, what the fuck?!)
minus-squareshape_warrior_t@programming.devlinkfedilinkEnglisharrow-up1·21 days agoYou can get the exclusive behaviour with random.randrange. (Relevant Stack Overflow question with a somewhat interesting answer)
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.
Any language… except MATLAB. Fuck MATLAB.
(Their arrays even start at 1, what the fuck?!)
You can get the exclusive behaviour with
random.randrange
. (Relevant Stack Overflow question with a somewhat interesting answer)