Using the lattice-Boltzmann method we have calculated the permeability of a random array of spheres and a clay soil. We have determined the structure of the clay soil by computed tomography imaging. As observed experimentally, the semiempirical Carman-Kozeny equation gives a good estimate for the permeability of the random array of spheres. For the soil sample, our calculated value of the permeability is consistent with experimental values. The Carman-Kozeny equation provides a much less successful estimate for the permeability of the soil than the random spheres.