@@ -26,7 +26,7 @@ |
||
26 | 26 | $remainder = substr($remainder, 0, 3); |
27 | 27 | $target = (int)($digit.$remainder); |
28 | 28 | $rangeMin = 0; |
29 | - $rangeMax = (int)str_repeat('9', strlen($remainder) + 1); |
|
29 | + $rangeMax = (int)str_repeat('9', strlen($remainder)+1); |
|
30 | 30 | } |
31 | 31 | |
32 | 32 | $random = RandomProvider::randomInt($rangeMin, $rangeMax, RandomMode::Speed)->asInt(); |
@@ -17,7 +17,7 @@ |
||
17 | 17 | $remainder = $this->remainderCheck(); |
18 | 18 | |
19 | 19 | if ($early == 0) { |
20 | - return ($nextDigit % 2 == 1 && !$remainder) ? 0 : 1; |
|
20 | + return ($nextDigit%2 == 1 && !$remainder) ? 0 : 1; |
|
21 | 21 | } else { |
22 | 22 | return $early == 1 ? 1 : 0; |
23 | 23 | } |
@@ -17,7 +17,7 @@ |
||
17 | 17 | $remainder = $this->remainderCheck(); |
18 | 18 | |
19 | 19 | if ($early == 0) { |
20 | - return ($nextDigit % 2 == 0 && !$remainder) ? 0 : 1; |
|
20 | + return ($nextDigit%2 == 0 && !$remainder) ? 0 : 1; |
|
21 | 21 | } else { |
22 | 22 | return $early == 1 ? 1 : 0; |
23 | 23 | } |
@@ -30,8 +30,8 @@ discard block |
||
30 | 30 | * @throws IncompatibleObjectState |
31 | 31 | */ |
32 | 32 | public static function randomInt( |
33 | - int|string|DecimalInterface $min, |
|
34 | - int|string|DecimalInterface $max, |
|
33 | + int | string | DecimalInterface $min, |
|
34 | + int | string | DecimalInterface $max, |
|
35 | 35 | RandomMode $mode = RandomMode::Entropy |
36 | 36 | ): ImmutableDecimal |
37 | 37 | { |
@@ -107,7 +107,7 @@ discard block |
||
107 | 107 | throw new OptionalExit( |
108 | 108 | 'System error from random_bytes().', |
109 | 109 | 'Ensure your system is configured correctly.', |
110 | - 'A call to random_bytes() threw a system level exception. Most often this is due to a problem with entropy sources in your configuration. Original exception message: ' . $e->getMessage() |
|
110 | + 'A call to random_bytes() threw a system level exception. Most often this is due to a problem with entropy sources in your configuration. Original exception message: '.$e->getMessage() |
|
111 | 111 | ); |
112 | 112 | } |
113 | 113 | } elseif ($mode == RandomMode::Speed) { |
@@ -147,14 +147,14 @@ discard block |
||
147 | 147 | */ |
148 | 148 | $entropyBytes = random_bytes($bytesNeeded->asInt()); |
149 | 149 | $baseTwoBytes = ''; |
150 | - for($i = 0; $i < strlen($entropyBytes); $i++){ |
|
151 | - $baseTwoBytes .= decbin( ord( $entropyBytes[$i] ) ); |
|
150 | + for ($i = 0;$i < strlen($entropyBytes);$i++) { |
|
151 | + $baseTwoBytes .= decbin(ord($entropyBytes[$i])); |
|
152 | 152 | } |
153 | 153 | } catch (Exception $e) { |
154 | 154 | throw new OptionalExit( |
155 | 155 | 'System error from random_bytes().', |
156 | 156 | 'Ensure your system is configured correctly.', |
157 | - 'A call to random_bytes() threw a system level exception. Most often this is due to a problem with entropy sources in your configuration. Original exception message: ' . $e->getMessage() |
|
157 | + 'A call to random_bytes() threw a system level exception. Most often this is due to a problem with entropy sources in your configuration. Original exception message: '.$e->getMessage() |
|
158 | 158 | ); |
159 | 159 | } |
160 | 160 | |
@@ -243,8 +243,8 @@ discard block |
||
243 | 243 | * @throws IncompatibleObjectState |
244 | 244 | */ |
245 | 245 | public static function randomReal( |
246 | - int|string|DecimalInterface $min, |
|
247 | - int|string|DecimalInterface $max, |
|
246 | + int | string | DecimalInterface $min, |
|
247 | + int | string | DecimalInterface $max, |
|
248 | 248 | int $scale, |
249 | 249 | RandomMode $mode = RandomMode::Entropy |
250 | 250 | ): ImmutableDecimal |
@@ -369,7 +369,7 @@ discard block |
||
369 | 369 | * We cannot take advantage of a more efficient check for the top end of the range, so the |
370 | 370 | * less than check is all we need. |
371 | 371 | */ |
372 | - $maxDecimal = str_pad('1', $scale + 1, '0'); |
|
372 | + $maxDecimal = str_pad('1', $scale+1, '0'); |
|
373 | 373 | } else { |
374 | 374 | /** |
375 | 375 | * The max value is guaranteed to have a decimal portion here since we excluded max being |
@@ -132,7 +132,7 @@ discard block |
||
132 | 132 | $roundedPartString = $currentPart ? $decimalPart : $wholePart; |
133 | 133 | $otherPart = $currentPart ? str_split($wholePart) : str_split($decimalPart); |
134 | 134 | $baseLength = $currentPart ? strlen($decimalPart)-1 : strlen($wholePart); |
135 | - $pos = $currentPart ? $places : $baseLength + $places; |
|
135 | + $pos = $currentPart ? $places : $baseLength+$places; |
|
136 | 136 | |
137 | 137 | if ($currentPart) { |
138 | 138 | $pos = ($absPlaces > $baseLength && $places < 0) ? $baseLength : $pos; |
@@ -211,7 +211,7 @@ discard block |
||
211 | 211 | bool $currentPart |
212 | 212 | ): array |
213 | 213 | { |
214 | - $digit = (int)$roundedPart[$pos] + $carry; |
|
214 | + $digit = (int)$roundedPart[$pos]+$carry; |
|
215 | 215 | |
216 | 216 | if ($carry == 0 && $digit == 5 && strlen($roundedPartString) > $pos+1) { |
217 | 217 | $remainder = substr($roundedPartString, $pos+1); |