let find_random_member_by_group (crit:criterion) (gl:student list)  
  (gnum:int) (padd:paddress) = 
  let rec find_rec lvl = 
    try
      find_random (fun s -> crit s lvl gnum padd) gl
    with Not_found -> if (lvl < maximum_level) then find_rec (lvl+1) 
    else failwith (Printf.sprintf "Missing member for group %d" gnum)
  in find_rec 0