According to Wikipedia , a linear congruent generator is defined by the recurrence relation below:
X(n) = {aX(n-1) + c} mod m
where 0 < m , 0 <= a < m , 0 <= c < m , 0 <= X(0) < m are integer constants that define the generator.
If the values a , c , m , X(0) and n , can I determine the k smallest value ( 1 <= k <= n ) for the set {X(0), X(1), ..., X(n)} really fast? (faster than O(n) - based on a sorting algorithm)
math algorithm
Love paper
source share