Application of random-choice method to problems in gasdynamics