Resetting random number generator before setting seed to avoid crashes.