The resulting bit-error rate (BER) is a key-performance indicator of a communication system. More often than we would like, there is no way to determine the bit error rate other than via Monte-Carlo simulation. In Monte-Carlo simulation, we simulate the system many (say $K$) times and count the number of occurrences of the event $E$ we're interested in (e.g. a bit error). If we count $B$ such events, we approximate the probability of this event as
$$
P[E] \approx \frac{B}{K}.
$$
This approximation will be better (according to the central limit theorem) for more samples $B$ we have collected.
We can also use the same method to approximate a whole PDF of a continuous variable $Y$ using quantization. To do this, we divide the range of possible values $\xi$ into $N$ bins correspoding to $y_i < Y \le y_{i+1}$. If for a total of $K$ runs, we found $Y$ to be $B_i$ times within this range, we estimate the corresponding probability as
$$
P[y_i < Y \le y_{i+1}] \approx \frac{B_i}{K}.
$$
The value of the PDF $p_y(\xi)$ of $Y$ at some point $\xi$ is approximated by probability estimate from the bin $(y_i,y_{i+1})$ that contains value $\xi$, divided by the bin spacing $y_{i+1}-y_i$ (to make the area under the curve equal to one):
$$
p_y(\xi) \approx \frac{B_i}{K\cdot (y_{i+1}-y_i)}, \qquad y_i < \xi \le y_{i+1}
$$
Again, this becomes more accurate for both larger numbers of samples $B_i$ and smaller bin spacing $y_{i+1}-y_i$.
In the following demo slide, we will have a look at the BER of a BPSK modulated signal $x\in \{-1,+1\}$ over the AWGN channel. In this particular case, we can also compute the BER exactly from the Q-function:
$$
P_{\mathrm{err}} = Q\left(\frac{1}{\sigma} \right)
$$
Observe that this is independent of the a priori probabilities $P[X=+1]$ and $P[X=-1]=1-P[X=+1]$. A Monte-Carlo simulation will verify this result.