(* Comparaison *) let zyva m n = printf "Vérification, %d essais, sur [1..%d]\n" n m ; let nfail = ref 0 in for i = 1 to n do let u = 1 + Random.int m and v = 1 + Random.int m in let p1 = euclide u v and p2 = college u v in if p1<>p2 then begin nfail := !nfail + 1 ; printf "Échec pour u=%d, v=%d: euclide=%d, college=%d\n" u v p1 p2 ; flush stdout end done ; if !nfail > 0 then printf "Il y a eu %d échec%s\n" !nfail (if !nfail > 1 then "s" else "") else printf "Que des succès\n" ;; let m = int_of_string Sys.argv.(1) and n = int_of_string Sys.argv.(2) ;; let _ = zyva m n ; exit 0 ;; |