Select a random object from a number of generated objects

How can i select a object at random from 40 generated objects?