Computing the Mordell-Weil rank of Jacobians of curves of genus two