Skip to content

Commit 207983c

Browse files
committed
Fix method order in randomizer.c
1 parent fc5e5f6 commit 207983c

File tree

1 file changed

+21
-21
lines changed

1 file changed

+21
-21
lines changed

ext/random/randomizer.c

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -88,27 +88,6 @@ PHP_METHOD(Random_Randomizer, __construct)
8888
}
8989
/* }}} */
9090

91-
/* {{{ Generate positive random number */
92-
PHP_METHOD(Random_Randomizer, nextInt)
93-
{
94-
php_random_randomizer *randomizer = Z_RANDOM_RANDOMIZER_P(ZEND_THIS);
95-
uint64_t result;
96-
97-
ZEND_PARSE_PARAMETERS_NONE();
98-
99-
result = randomizer->algo->generate(randomizer->status);
100-
if (EG(exception)) {
101-
RETURN_THROWS();
102-
}
103-
if (randomizer->status->last_generated_size > sizeof(zend_long)) {
104-
zend_throw_exception(random_ce_Random_RandomException, "Generated value exceeds size of int", 0);
105-
RETURN_THROWS();
106-
}
107-
108-
RETURN_LONG((zend_long) (result >> 1));
109-
}
110-
/* }}} */
111-
11291
/* {{{ Generate a float in [0, 1) */
11392
PHP_METHOD(Random_Randomizer, nextFloat)
11493
{
@@ -224,6 +203,27 @@ PHP_METHOD(Random_Randomizer, getFloat)
224203
}
225204
/* }}} */
226205

206+
/* {{{ Generate positive random number */
207+
PHP_METHOD(Random_Randomizer, nextInt)
208+
{
209+
php_random_randomizer *randomizer = Z_RANDOM_RANDOMIZER_P(ZEND_THIS);
210+
uint64_t result;
211+
212+
ZEND_PARSE_PARAMETERS_NONE();
213+
214+
result = randomizer->algo->generate(randomizer->status);
215+
if (EG(exception)) {
216+
RETURN_THROWS();
217+
}
218+
if (randomizer->status->last_generated_size > sizeof(zend_long)) {
219+
zend_throw_exception(random_ce_Random_RandomException, "Generated value exceeds size of int", 0);
220+
RETURN_THROWS();
221+
}
222+
223+
RETURN_LONG((zend_long) (result >> 1));
224+
}
225+
/* }}} */
226+
227227
/* {{{ Generate random number in range */
228228
PHP_METHOD(Random_Randomizer, getInt)
229229
{

0 commit comments

Comments
 (0)