Simplify the code a little and add '!' to functions that use random numbers.