Noise-induced phenomena in transient dynamics of short and long Josephson junctions