random() refactoring - not sure I like it