Skip to content

Commit 4ae2ce0

Browse files
committed
finish rand function
1 parent 7fb9203 commit 4ae2ce0

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed

src/FunctionRegistrar.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,9 @@ class FunctionRegistrar
99
protected $functions = [
1010
Functions\Curdate::class,
1111
Functions\DateFormat::class,
12-
Functions\Substring::class,
12+
Functions\Rand::class,
1313
Functions\Regexp::class,
14+
Functions\Substring::class,
1415
];
1516

1617
/**

src/Functions/Rand.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
namespace Appel\SqliteFunctions\Functions;
44

5-
use Closure
5+
use Closure;
66

77
class Rand extends AbstractFunction
88
{
@@ -13,8 +13,8 @@ class Rand extends AbstractFunction
1313
*/
1414
public function mysql(): Closure
1515
{
16-
return function ($seed) {
17-
return mt_rand() / mt_getrandmax();
16+
return function ($seed = null) {
17+
return mt_srand($seed) / mt_getrandmax();
1818
};
1919
}
2020
}

0 commit comments

Comments
 (0)