• rutrum@lm.paradisus.day
    link
    fedilink
    English
    arrow-up
    0
    ·
    11 months ago

    How exactly do you simulate die rolls? Do you actually use a random number a bunch of times and average? Because its 2d6, it has a known distribution. You could iterate over all combinations and use the probably distribution to weight each result. How did you accomplish this?

    • rocket9@feddit.deOP
      link
      fedilink
      English
      arrow-up
      0
      ·
      10 months ago

      I use the crypto/rand package which provides cryptographically secure random numbers. I verified the distribution when implementing it in the server and it consistently meets the expected distribution.