From 76efebe0ac84835d434a59a50e90940925dc90c7 Mon Sep 17 00:00:00 2001 From: Marcel Hernandez Date: Fri, 19 Jan 2018 19:31:02 +0100 Subject: [PATCH] generate random clockSeq with random_int() instead of mt_rand() --- src/Generator/DefaultTimeGenerator.php | 2 +- tests/Generator/DefaultTimeGeneratorTest.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Generator/DefaultTimeGenerator.php b/src/Generator/DefaultTimeGenerator.php index 9733ed6..f05d818 100644 --- a/src/Generator/DefaultTimeGenerator.php +++ b/src/Generator/DefaultTimeGenerator.php @@ -79,7 +79,7 @@ class DefaultTimeGenerator implements TimeGeneratorInterface if ($clockSeq === null) { // Not using "stable storage"; see RFC 4122, Section 4.2.1.1 - $clockSeq = mt_rand(0, 0x3fff); + $clockSeq = random_int(0, 0x3fff); } // Create a 60-bit time value as a count of 100-nanosecond intervals diff --git a/tests/Generator/DefaultTimeGeneratorTest.php b/tests/Generator/DefaultTimeGeneratorTest.php index 132c785..b12f6b5 100644 --- a/tests/Generator/DefaultTimeGeneratorTest.php +++ b/tests/Generator/DefaultTimeGeneratorTest.php @@ -166,7 +166,7 @@ class DefaultTimeGeneratorTest extends TestCase public function testGenerateUsesRandomSequenceWhenClockSeqNull() { $this->skipIfHhvm(); - $mt_rand = AspectMock::func('Ramsey\Uuid\Generator', 'mt_rand', 9622); + $mt_rand = AspectMock::func('Ramsey\Uuid\Generator', 'random_int', 9622); $defaultTimeGenerator = new DefaultTimeGenerator( $this->nodeProvider, $this->timeConverter,