def get_instance_number(pid, tid):
"""
Maps the token to an instance number for a prolem.
Args:
pid: the problem id
tid: the team id
Returns:
The instance number
"""
previous_state = seed_generator(tid, pid)
total_instances = get_number_of_instances(pid)
if total_instances == 0:
raise InternalException("{} has no instances.".format(pid))
instance_number = random.randint(0, total_instances-1)
random.setstate(previous_state)
return instance_number
评论列表
文章目录