Analysis of the nonlinear response of a cantilever beam under deterministic and random excitations