Python general-purpose linear congruential generator (LCG) function