This is not RPG related question, but since anydice questions are allowed:

Does anyone know how the | operation is defined in anydice?

Here is what documentation has to say:


In general, the number 0 represents no while any other number – either positive or negative – represents yes. Using this logic, AnyDice allows you to perform boolean operations. This is useful if you like to check multiple conditions. Boolean operations have a lower precedence than all conditions, except for Not, which is a unary operation.

In the examples below, assume that the variable YES is set to any number other than 0, while NO is set to 0.

And also

YES & YES yields 1, while any other YES and NO combination yields 0.

Or else

NO | NO yields 0, while any other YES and NO combination yields 1.


!YES yields 0, while !NO yields 1.

There is nothing here that would indicate that the operation is asymmetrical. However given the following code:

output A | B
output B | A

We get the following output:

"output 1",0.875,0.33071891388307384,0,1

"output 2",0.375,0.4841229182759271,0,1

Clearly A|B is not the same as B|A. I understand, that since A and B both dice and not number conversion rules might kick-in. But I still expect the rules to lead to symmetrical results.

What's going on here?

  • \$\begingroup\$ Also wierd. Iirc A|B|A = A|B \$\endgroup\$ Jun 17 '18 at 4:20
  • 1
    \$\begingroup\$ Also, even by my rather inclusive personal standard, I kind of feel like this question belongs on SO, not here. Maybe it's because it doesn't even pretend to be RPG-related. \$\endgroup\$ Jun 17 '18 at 10:36
  • 2
    \$\begingroup\$ Now that I'm home, I tried testing this, but I couldn't reproduce the issue. The code you linked above gives me the same output (12.5% chance of 0, 87.5% chance of 1) for both A | B and B | A. The only explanation I can think of (other than some silly mistake like forgetting to click "Calculate" after editing the code) is that this was a bug in AnyDice that the developer fixed within the last 13 hours or so. \$\endgroup\$ Jun 17 '18 at 16:28
  • 1
    \$\begingroup\$ I’m closing the question because the output it’s based on can’t be reproduced. \$\endgroup\$ Jun 17 '18 at 17:42
  • 1
    \$\begingroup\$ That was a bug that is now fixed: twitter.com/catlikecoding/status/1008372654917726208 \$\endgroup\$ Jun 17 '18 at 20:39

Browse other questions tagged or ask your own question.