Long time dynamics of random data nonlinear wave and dispersive equations