for x in range(0, 10):
    number_of_tries = 0
MAX_TRIES = 10
generating_random = true
while generating_random:
    minimum = random.randrange(0, max_line, 6)
if minimum not in previous_vals:
    previous_vals.add(minimum)
generating_random = false
number_of_tries += 1
if number_of_tries == MAX_TRIES:
    raise RunTimeError('Maximum number of random tries reached!')
maximum = minimum + 6
listQ = listQ[minimum:maximum]
checking if a random value exists from previous loop