src/ActiveDoctrine/Entity/EntityCollection.php
public function getRandom()
    {
        return empty($this->entities) ? null : $this->entities[array_rand($this->entities)];
    }
public function getRandom()
    {
        return empty($this->entities) ? null : $this->entities[array_rand($this->entities)];
    }
public function getRandom ( ) { return empty ( $ this -> entities ) ? null : $ this -> entities [ array_rand ( $ this -> entities ) ] ; }
Get a random Entity from this collection, or null if the
collection is empty.

@return Entity|null
Get a random Entity from this collection or null if the collection is empty .