Generation of radiative knots in a randomly pulsed protostellar jet I. Dynamics and energetics