A technique for the solution of the master equation and of the diffusion equation, via a random walk simulation, is proposed and applied to a variety of problems of interest in the fields of physics, biology, and chemistry. They include the kinetics of a single particle, which can diffuse along a one-dimensional lattice and eventually leave it from its end points, with a given probability, and the generalization to more complex two-dimensional geometries or more particles (the many-walkers problem). The technique is particularly suitable for parallel processing, which provides extreme efficiency and flexibility to the method.