Creating a LCG with m = 32767
The output of an LCG with modulus $m$ is in range $[0\dots m-1]$. Hence the choice of $m=32767$ forbids the output to be $32767$. Perhaps the OP wants $m=32768$.

We want to compute $(a\cdot x+c)\bmod m$ for known constant integers $a$ $c$ $m$ on a system restricted to integers in $[0\dots32767]$ (or is it $[-32767\dots32767]$ or $[-32768\dots32767]$, but that only makes the problem easier).

We can compute $z=(x+y)\bmod m$ on this system, assuming $0\le x&lt;m$ and $0\le y&lt;m$, as
&nbsp;&nbsp;&nbsp;&nbsp;
if (m-x &gt; y) z = x+y; else z = y-(m-x); &nbsp; when $0&lt;m\le32767$, or as
&nbsp;&nbsp;&nbsp;&nbsp;
if (32767-x &gt;= y) z = x+y; else z = (y-(32767-x))-1; &nbsp;  when $m=32768$

From this primitive, it is easy to build $(a\cdot x)\bmod m$ by an addition chain, then $(a\cdot x+c)\bmod m$.