schlunker
  • Communities
  • Create Post
  • Create Community
  • heart
    Support Lemmy
  • search
    Search
  • Login
  • Sign Up
maris@lemmy.world to Programmer Humor@programming.dev · 2 days ago

Gambling with Lain

lemmy.world

message-square
33
fedilink
322

Gambling with Lain

lemmy.world

maris@lemmy.world to Programmer Humor@programming.dev · 2 days ago
message-square
33
fedilink
  • ChaoticNeutralCzech@feddit.org
    link
    fedilink
    English
    arrow-up
    12
    ·
    2 days ago

    The chance is actually 1 in 7 because both 0 and 6 are included in the randInt() range.

    • r00ty@kbin.life
      link
      fedilink
      arrow-up
      5
      ·
      2 days ago

      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.

      • shape_warrior_t@programming.dev
        link
        fedilink
        English
        arrow-up
        1
        ·
        1 day ago

        You can get the exclusive behaviour with random.randrange. (Relevant Stack Overflow question with a somewhat interesting answer)

      • ChaoticNeutralCzech@feddit.org
        link
        fedilink
        English
        arrow-up
        1
        ·
        1 day ago

        Any language… except MATLAB. Fuck MATLAB.

        (Their arrays even start at 1, what the fuck?!)

        • wheezy@lemmy.ml
          link
          fedilink
          arrow-up
          2
          arrow-down
          1
          ·
          edit-2
          1 day ago

          Lua starts at 1 too. It’s infuriating. I believe for the same historical reason Matlab does.

          Both meant for non CS people.

Programmer Humor@programming.dev

programmer_humor@programming.dev

Subscribe from Remote Instance

Create a post
You are not logged in. However you can subscribe from another Fediverse account, for example Lemmy or Mastodon. To do this, paste the following into the search field of your instance: !programmer_humor@programming.dev

Welcome to Programmer Humor!

This is a place where you can post jokes, memes, humor, etc. related to programming!

For sharing awful code theres also Programming Horror.

Rules

  • Keep content in english
  • No advertisements
  • Posts must be related to programming or programmer topics
Visibility: Public
globe

This community can be federated to other instances and be posted/commented in by their users.

  • 1.74K users / day
  • 4.26K users / week
  • 7.8K users / month
  • 20.2K users / 6 months
  • 1 local subscriber
  • 25.1K subscribers
  • 1.58K Posts
  • 58.3K Comments
  • Modlog
  • mods:
  • Feyter@programming.dev
  • adr1an@programming.dev
  • BurningTurtle@programming.dev
  • Pierre-Yves Lapersonne@programming.dev
  • BE: 0.19.5
  • Modlog
  • Instances
  • Docs
  • Code
  • join-lemmy.org