List Info

Thread: "ocaml_beginners"::[] Re: Fast IO




"ocaml_beginners"::[] Re: Fast IO
user name
2006-12-19 07:33:19

This will make a large input file suitable for testing code for
problem 450.

Use:
ocamlopt -o 450gen 450gen.ml

dos: 450 > 450input.txt
unix: ./450 > 450input.txt

let rec exp a = function
0 -> 1
| n -> a*(exp a (n-1));;

Random.self_init ();;

let n = 10000000;;

let k = Random.int (exp 10 7) + 1

let ten9 = exp 10 9;;

Printf.printf "%i %in" n k;

for i=1 to n do
Printf.printf "%in" (Random.int ten9 + 1)
done;

flush stdout;
exit 0;

__._,_.___
.

__,_._,___
[1]

about | contact  Other archives ( Real Estate discussion Medical topics )