  This paper presents a sharp approximation of the density of long runs of a
random walk conditioned on its end value or by an average of a functions of its
summands as their number tends to infinity. The conditioning event is of
moderate or large deviation type. The result extends the Gibbs conditional
principle in the sense that it provides a description of the distribution of
the random walk on long subsequences. An algorithm for the simulation of such
long runs is presented, together with an algorithm determining their maximal
length for which the approximation is valid up to a prescribed accuracy.
