38
\$\begingroup\$

Is it possible to weight the dice in AnyDice.com and then use like normal?

I'd like to use a standard d6, with values 1-6, but weighted such that the probability for rolling a specific value is as follows.

1: 18%
2: 18%
3: 19%
4: 18%
5: 17%
6: 10%

I'd then like to find the probability of

Xd6
Xd6 +Y
Xd6 +Y dropping lowest N
etc.

Can this be done?

\$\endgroup\$
65
\$\begingroup\$

Yes, this can be done. The Anydice documentation details how we can describe arbitrary dice. Functionally with percentages like that, the dice is equivalent to:

  • 18 sides of value 1, 2 and 4.
  • 19 sides of value 3.
  • 17 sides of value 5.
  • 10 sides of value 6.

... So we'll define exactly that die in this Anydice program:

W: {
 1:18,
 2:18,
 3:19,
 4:18,
 5:17,
 6:10
}

output d6 \ for comparison \
output dW

anydice output with correct percentages

The syntax used there is sequences, and we're using it so we don't have to write out {1, 1, 1, 1, 1, 1, 1, 1... and so on eighteen times, and then the same for the five other faces. That's too prone to error and difficult to read. A more normal usage of sequences is writing 1..3:2, which is a sequence from 1 to 3 repeated twice, which is to say it represents 1, 2, 3, 1, 2, 3. We're generating a sequence that contains 1 repeated 18 times. The same goes for the other values.

W is a variable (covered in The Basics in the documentation). Variables must be uppercase, but you can name it whatever you want, including WEIGHTED_DIE if you'd prefer.

\$\endgroup\$
  • 1
    \$\begingroup\$ That's a bit more elegant than what I was writing out, so +1 for you :) \$\endgroup\$ – Erik May 6 '18 at 19:33
  • 3
    \$\begingroup\$ Great answer. I took the liberty of improving the anydice syntax. You don't have to provide ranges for every repeater. \$\endgroup\$ – edgerunner May 6 '18 at 20:40
  • 2
    \$\begingroup\$ @edgerunner Wow, that's impressive. Thanks very much for that. :) \$\endgroup\$ – doppelgreener May 6 '18 at 20:57
  • 3
    \$\begingroup\$ When there's troubleyou call dW? \$\endgroup\$ – nitsua60 May 6 '18 at 22:35
  • 2
    \$\begingroup\$ I read the documentation on sequences, but some how missed where it talked about this. Also I don't know if I ever would've thought "19 sides of value 3" so that's awesome. Thank you very much! \$\endgroup\$ – Doug B May 7 '18 at 1:34

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.