Processing math: 100%

 

 

 

Random number generator RNG, RAN0

To see how this works we note first that (aNi1)MOD(M)=(aNi1[Ni1/q]M)MOD(M), since we can add or subtract any integer multiple of M from aNi1. The last term [Ni1/q]MMOD(M) is zero since the integer division [Ni1/q] just yields a constant which is multiplied with M.