Your random number generator will produce (pseudo) random numbers uniformly distributed on $(0,1)$.
Suppose that we want to simulate a random variable $X$ which takes on value $3$ with probability $0.25$, value $7$ with probability $0.35$, and value $45.6$ with probability $0.40$ (of course, this is not your problem, just a similar one).
Use the following idea. If the random number generator produces a number between $0$ and $0.25$, report that $X$ has taken on value $3$.
If the random number generator produces a number between $0.25$ and $0.25+0.35$, that is, between $0.25$ and $0.60$, report that $X$ has taken on the value $7$.
Finally, if the random number generator produces a number between $0.25+0.35$ and $1$, report that $X$ has taken on the value $45.6$.
Note that the probability that the random number generator produces a number between $0$ and $0.25$ is $0.25$. So with probability $0.25$ we will be reporting that $X$ has taken on value $3$. The probability that the random number generator produces a number between $0.25$ and $0.25+0.35$ is $0.35$, so with probability $0.35$ we will be reporting that $X$ has taken on value $17$. And so on.
Remarks: 1) In principle, the random number generator produces "random" reals between $0$ and $1$. So the probability it produces a particular number $u$, like $1/\pi$, is $0$. In practice, the numbers produced are say decimals, to $10$ decimal places. So our program needs to deal with the highly improbable but possible situations where the random number produced is exactly at a boundary, like $0.25$. It doesn't really matter what we do.
2) The procedure we use can also be described in terms of the cumulative distribution function of the random variable we are trying to simulate. Perhaps you are expected to do it in that style, in preparation for more complex problems when we are simulating a continuously distributed random variable $X$. If a description in terms of the cdf is required, please indicate.