# Can AnyDice.com handle weighted dice?

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?

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


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.

• That's a bit more elegant than what I was writing out, so +1 for you :)
– Erik
May 6 '18 at 19:33
• Great answer. I took the liberty of improving the anydice syntax. You don't have to provide ranges for every repeater. May 6 '18 at 20:40
• @edgerunner Wow, that's impressive. Thanks very much for that. :) May 6 '18 at 20:57
• When there's troubleyou call dW? May 6 '18 at 22:35
• 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! May 7 '18 at 1:34