  Zero temperature properties of a dilute weakly interacting $d$-dimensional
Bose gas in a random potential are studied. We calculate geometrical and
energetic characteristics of the localized state of a gas confined in a large
box or in a harmonic trap. Different regimes of the localized state are found
depending on the ratio of two characteristic length scales of the disorder, the
Larkin length and the disorder correlation length. Repulsing bosons confined in
a large box with average density $n$ well below a critical value $n_c$ are
trapped in deep potential wells of extension much smaller than distance between
them. Tunneling between these wells is exponentially small. The ground state of
such a gas is a random singlet with no long-range phase correlation For $n>n_c$
repulsion between particles overcomes the disorder and the gas transits from
the localized to a coherent superfluid state. The critical density $n_c$ is
calculated in terms of the disorder parameters and the interaction strength.
For atoms in traps four different regimes are found, only one of it is
superfluid. The theory is extended to lower (1 and 2) dimensions. Its
quantitative predictions can be checked in experiments with ultracold atomic
gases and other Bose-systems.
