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.
In the case where all $\lambda_j$ are equal, let's say to $\mu$, you can compute
$$ \mathbb E\left[ \exp(itY) \mid N \right] = \exp(\mu (e^{it}-1) N)$$
so that
$$ \mathbb E[\exp(itY)] = \mathbb E [\exp(\mu(e^{it}-1)N] = \exp(\lambda ( \exp(\mu (e^{it}-1))-1))$$
which is not the characteristic function of a Poisson distribution.
However, things are more complicated if the $\lambda_j$ are not all equal.
EDIT: In general, let $s_n = \sum_{j=1}^n \mu_j$. In particular $s_0 = 0$. Then
$$ \mathbb E \left[\exp(itY) \mid N \right] = \mathbb E \left[\exp(s_N (e^{it}-1))\right] = \exp(-\lambda) \sum_{n=0}^\infty \dfrac{\lambda^n}{n!} \exp(s_n (e^{it}-1)) $$
Letting $z = 1 - e^{it}$, we want to know if there is a formula
$$ \exp(-\lambda) \sum_{n=0}^\infty \dfrac{\lambda^n}{n!} \exp(-s_n z) =
\exp(-\rho z)$$ where $\rho > 0$.
If this is valid for $z = 1 - e^{it}$, by analyticity it must be valid in the right
half plane. Now as $z \to +\infty$, the limit of the left side is
$\exp(-\lambda)$ (since $s_0 = 0$), while the limit of the right side is $0$. So this is impossible: the distribution is not Poisson.
Best Answer
There are many ways to do this; some of which are more computationally efficient than others. If you want to use a single generated value $U \sim \text{U}(0,1)$ then you can use inverse transform sampling using the cumulative distribution function for the Poisson distribution. This gives the output:
$$P \equiv \min \Bigg\{ p =0,1,2,... \Bigg| U \leqslant \exp(-\lambda) \sum_{i=0}^p \frac{\lambda^p}{p!} \Bigg\}.$$
Alternatively, if you are willing to use multiple independent generated values $U_1,U_2,U_3, ... \sim \text{IID U}(0,1)$ then you can use the fact that a Poisson random variable with parameter $\lambda$ is given by the number of sequential events occurring in time $\lambda$ where the times between the events are independent exponential random variables with unit rate. Applying this relationship yields the alternative method:
$$P \equiv \min \Bigg\{ p =0,1,2,... \Bigg| - \sum_{i=1}^p \ln(1-U_i) \leqslant \lambda \Bigg\}.$$
In both cases you can program these with a simple
while
loop in an appropriate computational platform with a uniform pseudo-random number generator.