We introduce a method to sample the orientational distribution function in computer simulations. The method is based on the exact torque balance equation for classical many-body systems of interacting anisotropic particles in equilibrium. Instead of the traditional counting of events, we reconstruct the orientational distribution function via an orientational integral of the torque acting on the particles. We test the torque sampling method in two- and three-dimensions, using both Langevin dynamics and overdamped Brownian dynamics, and with two interparticle interaction potentials. In all cases the torque sampling method produces profiles of the orientational distribution function with better accuracy than those obtained with the traditional counting method. The accuracy of the torque sampling method is independent of the bin size, and hence it is possible to resolve the orientational distribution function with arbitrarily small angular resolutions.