added random number generator (exercise 18.3)