  We present a new method to identify and characterize the structure of the
intracluster medium (ICM) in simulated galaxy clusters. The method uses the
median of gas properties, such as density and pressure, which we show to be
very robust to the presence of gas inhomogeneities. In particular, we show that
the radial profiles of median gas properties are smooth and do not exhibit
fluctuations at locations of massive clumps in contrast to mean and mode
properties. It is shown that distribution of gas properties in a given radial
shell can be well described by a log-normal PDF and a tail. The former
corresponds to a nearly hydrostatic bulk component, accounting for ~99% of the
volume, while the tail corresponds to high density inhomogeneities. We show
that this results in a simple and robust separation of the diffuse and clumpy
components of the ICM. The FWHM of the density distribution grows with radius
and varies from ~0.15 dex in cluster centre to ~0.5 dex at 2r_500 in relaxed
clusters. The small scatter in the width between relaxed clusters suggests that
the degree of inhomogeneity is a robust characteristic of the ICM. It broadly
agrees with the amplitude of density perturbations in the Coma cluster. We
discuss the origin of ICM density variations in spherical shells and show that
less than 20% of the width can be attributed to the triaxiality of the cluster
gravitational potential. As a link to X-ray observations of real clusters we
evaluated the ICM clumping factor with and without high density
inhomogeneities. We argue that these two cases represent upper and lower limits
on the departure of the observed X-ray emissivity from the median value. We
find that the typical value of the clumping factor in the bulk component of
relaxed clusters varies from ~1.1-1.2 at r_500 up to ~1.3-1.4 at r_200, in
broad agreement with recent observations.
