Instructions:
The test fixture I use for this kata is pre-populated.
It will compare your guess to a random number generated using:
rand(1, 100)
You can pass by relying on luck or skill but try not to rely on luck.
"The power to define the situation is the ultimate power." - Jerry Rubin
Good luck!
Solution:
//方案1:初始化随机数。
srand(0);
$guess = rand(1,100);
srand(0);
//方案2:
$guess = true;
Sample Tests:
class DontRelyOnLuckKata extends TestCase
{
//This is exactly what the real test fixture looks like.
public function testYourLuck() {
global $guess;
$lucky_number = rand(1, 100);
$this->assertEquals($lucky_number, $guess, "Sorry. Unlucky this time.");
}
}