public function testRandCharacter() { for ($i = 0; $i < 2000; $i++) { $c = _Rand::_randCharacter(); if (!isset($hash[$c])) { $hash[$c] = 1; } else { $hash[$c]++; } $code = ord($c); $this->assertGreaterThanOrEqual(32, $code); $this->assertLessThanOrEqual(126, $code); } // A perfect distribution would have 94 different chars. // Allow for the off chance that maybe 1 char isn't used in 2000 iterations $this->assertGreaterThanOrEqual(93, count($hash)); }