chap patterns of algorithms there is no such thing as random number sequenceonly "random enoughsequences sequence is pseudorandom if no future term can be predicted in polynomial timegiven all past terms most computer systems use deterministic algorithm to select pseudorandom numbers the most commonly used approach historically is known as the linear congruential method (lcmthe lcm method is quite simple we begin by picking seed that we will call ( thenwe can compute successive terms as follows ( ( ( bmod where and are constants by definition of the mod functionall generated numbers must be in the range to nowconsider what happens when (ir(jfor values and of course then ( ( which means that we have repeating cycle since the values coming out of the random number generator are between and the longest cycle that we can hope for has length in factsince ( it cannot even be quite this long it turns out that to get good resultit is crucial to pick good values for both and to see whyconsider the following example example given value of we can get very different results depending on the value that we pickin ways that are hard to predict ( ( mod ( ( mod ( ( mod clearlya value of is far inferior to values of or in this example if you would like to write simple lcm random number generator of your ownan effective one can be made with the following formula ( ( mod