Fix deprecated usage of randomNumber