/** * @param DataAdapterInterface $data * @param int $length * * @return string */ public function getRandomSample(DataAdapterInterface $data, $length) { $sample = ''; $maxByte = $data->getSize() - 1; for ($i = 0; $i < $length; $i++) { $randomIndex = mt_rand(0, $maxByte); $sample .= $data->getByte($randomIndex); } return $sample; }
/** * @throws Exception */ public function testGetSize() { $this->assertEquals(self::$adapter->getSize(), self::$length); }
/** * @throws Exception */ public function testGetSize() { $this->assertEquals(self::$adapter->getSize(), strlen(self::$testString)); }