Skip to content
This repository has been archived by the owner on Dec 11, 2020. It is now read-only.

Update Generator.php #632

Merged
merged 1 commit into from
Jul 15, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/Faker/Generator.php
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@ public function seed($seed = null)
if ($seed === null) {
mt_srand();
} else {
mt_srand($seed);
mt_srand((int) $seed);
}
}

Expand Down
3 changes: 3 additions & 0 deletions test/Faker/GeneratorTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,9 @@ public function testSeed()
$this->assertNotEquals($mtRandWithSeedZero, $mtRandWithoutSeed, 'seed() should be different than seed(0)');
$generator->seed();
$this->assertNotEquals($mtRandWithoutSeed, mt_rand(), 'seed() should not be deterministic.');

$generator->seed('10');
$this->assertTrue(true, 'seeding with a non int value doesn\'t throw an exception');
}
}

Expand Down