function average = scalar_code ( n )
  average = 0.0;
  for test = 1 : n
    p1 = rand(2,1);
    p2 = rand(2,1);
    d = vecnorm ( p1 - p2 );
    average = average + d;
  end
  average = average / n;
  return
end

