Replaced random by Rnd class.