function rand_int(i,j: integer): integer;
begin
  rand_int := trunc(random(1)*(j-i+2)+i-1);
end;
