use a counter instead of a random number generator