1--TEST--
2rand() and mt_rand() tests
3--FILE--
4<?php
5
6var_dump(mt_rand());
7var_dump(mt_rand(-1,1));
8var_dump(mt_rand(0,3));
9
10var_dump(rand());
11var_dump(rand(-1,1));
12var_dump(rand(0,3));
13
14var_dump(srand());
15var_dump(srand(-1));
16try {
17    srand(mode: MT_RAND_MT19937);
18} catch (Error $e) {
19    echo $e->getMessage() . "\n";
20}
21
22var_dump(mt_srand());
23var_dump(mt_srand(-1));
24
25try {
26    mt_srand(mode: MT_RAND_MT19937);
27} catch (Error $e) {
28    echo $e->getMessage() . "\n";
29}
30
31var_dump(getrandmax());
32
33var_dump(mt_getrandmax());
34
35echo "Done\n";
36?>
37--EXPECTF--
38int(%d)
39int(%i)
40int(%d)
41int(%d)
42int(%i)
43int(%d)
44NULL
45NULL
46srand(): Argument #1 ($seed) must be passed explicitly, because the default value is not known
47NULL
48NULL
49mt_srand(): Argument #1 ($seed) must be passed explicitly, because the default value is not known
50int(%d)
51int(%d)
52Done
53