Stochastic method for calculating the ground-state one-body density matrix of trapped Bose particles in one dimension