Equation with different levels

I am currently trying to get the following equation into my paper. Unfortunately, I have no idea about how to have only one level on the left side whereas two levels on the right side of the equation. Does anyone have an idea how to put that in Latex?

Thanks in advance! :) Best, Felix

• Try \begin{cases}1&\text[with probability } \pi\\0&...\end{cases}. You will need \usepackage{amsmath}. There are other cases environments in the mathtools package. – Andrew Dec 3 '16 at 12:17

\documentclass{article}
$y^i = \begin{cases} 1 & \text{with probability \pi^i+\theta e^i} \\ 0 & \text{with probability 1-(\pi^i+\theta e^i)} \end{cases}$