Adds a function that selects a element at random