The way to solve the problem in the question is to change the question slightly (beyond changing "Psuedo" to pseudo-code).
What really is wanted most likely is
- A public-private key pair generation method
- An encryption function $E$; accepting as input any integer in $\mathbb Z_N$ (the plaintext), a public key generated as above, and a random number; producing as output an integer in $\mathbb Z_R$ (the ciphertext); so that knowledge of the ciphertext without the private key and the random number essentially won't reveal anything about the plaintext (with the possible exception of negligibly few plaintext). We'll note encryption $E$ functionally, omitting both it's public-key and random inputs: $E(5)$ will thus be different from one invocation to the other, including for a fixed public-private key pair.
- A decryption function $D$, accepting as an element of $\mathbb Z_R$ and the private key, with the property that for $\forall x\in\mathbb Z_N, D(E(x))=x$ (when the public and private keys match).
- An operation $\boxplus$ on $\mathbb Z_R$, such that
$$\forall x\in\mathbb Z_N,\forall y\in\mathbb Z_N,\ \ x+y<N\implies D(E(x)\boxplus E(y))=x+y$$
Pallier encryption provides just that, with $R=N^2$ and $\boxplus$ defined as $u\boxplus v\ =\ u\cdot v\bmod R$.
Note: notation in this answer was adjusted to better match standard texts on Pailler encryption; refer to e.g. Jonathan Katz and Yehuda Lindell's Introduction to Modern Cryptography (2nd edition) section 13.2.