We show here how the linear congruential algorithm can be implemented, namely $$ \begin{equation*} N_i=(aN_{i-1}) \mathrm{MOD} (M). \end{equation*} $$ However, since \( a \) and \( N_{i-1} \) are integers and their multiplication could become greater than the standard 32 bit integer, there is a trick via Schrage's algorithm which approximates the multiplication of large integers through the factorization $$ \begin{equation*} M=aq+r, \end{equation*} $$ where we have defined $$ \begin{equation*} q=[M/a], \end{equation*} $$ and $$ \begin{equation*} r = M\hspace{0.1cm}\mathrm{MOD} \hspace{0.1cm}a. \end{equation*} $$ where the brackets denote integer division. In the code below the numbers \( q \) and \( r \) are chosen so that \( r < q \).