Weighted sum of two dice such that the result is a random integer between $0$ and $35$

The values of $S$ can be represented as $6a+b$ where $a$ and $b$ range from 0 to 5; there is a one-to-one matching between pairs $(a,b)$ and numbers in $S$. Accordingly, $6(a-1)+(b-1)=6a+b-7$ yields the same pairing, but for $a$ and $b$ from 1 to 6 – the actual faces of the dice. Therefore, to have each score appear with equal probability we should have $$A=6,B=1,C=-7$$


The maximum value of $S$ (assuming $A,B\geqslant0$) is $6(A+B)+C$, and the minimum value $A+B+C$. This gives us the system of equations \begin{align} 6A+6B+C &= 35\\ A+B+C &= 0. \end{align} Gaussian elimination yields $C=-7$, and therefore $A+B=7$. So $(A,B,C)=(6,1,-7)$ and $(1,6,-7)$. Taking $(A,B,C)=(6,1,-7)$ yields $$S = 6d + e -7, $$ so that for any $j\in\{0,1,\ldots,35\}$, $$j= 6d_j+e_j-7 $$ where \begin{align} d_j &= 1 +\left\lfloor \frac {j}6\right\rfloor\\ e_j &= j+7 -6d_j. \end{align}


I'm sure a more rigorous approach is possible, but thinking about this intuitively:

If we are rolling two dice, there are 6x6=36 possible outcomes. 0 to 35 is a range of 36 possible outcomes. Therefore, the solution must involve exactly one combination of the roll of the dice for each outcome: we can't have 2,1 and 1,2 both mapping to the same value, for example.

So I imagine a 2-dimensional table with 6 rows and 6 columns, with each cell in the table having a different number, from 0 to 35. The first row would be 0 to 5, the second 6 to 11, and so on. Every number from 0 to 35 occurs. Each number occurs exactly once, that is, each number represents exactly one combination of the roll of two dice, so all have equal probability.

I could generate the first number in each row by subtracting one from the die roll and then multiplying by 6. Or, if you prefer, multiply by 6 and then subtract 6. For the column offset I take the second die minus 1. That is:

S=(d x 6 - 6) + (e - 1)

or

S=d x 6 + e - 7