protected function randomizeSamples($referencePrefix, array $samples, $limit = 1)
    {
        $sample = array_rand($samples, $limit);
        
        if (1 === $limit) {
            $referenceName = sprintf('%s_%s', $referencePrefix, $samples[$sample]);
            
            return $this->getReference($referenceName);
        } else {
            $collection = new ArrayCollection();
            foreach ($sample as $index) {
                $referenceName = sprintf('%s_%s', $referencePrefix, $samples[$index]);
                $collection->add($this->getReference($referenceName));
            }
            
            return $collection;
        }
    }
protected function randomizeSamples($referencePrefix, array $samples, $limit = 1)
    {
        $sample = array_rand($samples, $limit);
        
        if (1 === $limit) {
            $referenceName = sprintf('%s_%s', $referencePrefix, $samples[$sample]);
            
            return $this->getReference($referenceName);
        } else {
            $collection = new ArrayCollection();
            foreach ($sample as $index) {
                $referenceName = sprintf('%s_%s', $referencePrefix, $samples[$index]);
                $collection->add($this->getReference($referenceName));
            }
            
            return $collection;
        }
    }
Returns random entity or collection of entities

@param       $referencePrefix
@param array $samples
@param int   $limit

@return object