<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def throw_random( lengths, mask ):
 """ Try multiple times to run 'throw_random' """

    saved = None
    for i in range( maxtries ):
        try:
            return throw_random_bits( lengths, mask )
        except MaxtriesException as e:
            saved = e
            continue
    raise e