summaryrefslogtreecommitdiff
path: root/ext/standard/tests/math/mt_rand_value.phpt
blob: 772305ad632f2c5ada5b2a737d7e69f2e42faea1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
--TEST--
Test mt_rand() output
--FILE--
<?php

mt_srand(12345678);

for ($i=0; $i<16; $i++) {
    echo mt_rand().PHP_EOL;
}
echo PHP_EOL;

$x = 0;
for ($i=0; $i<1024; $i++) {
    $x ^= mt_rand();
}
echo $x.PHP_EOL;

/*
 * Note that the output will be different from the original mt19937ar.c,
 * because PHP's implementation contains a bug. Thus, this test actually
 * checks to make sure that PHP's behaviour is wrong, but consistently so.
 */

?>
--EXPECTF--
1614640687
1711027313
857485497
688176834
1386682158
412773096
813703253
898651287
2087374214
1382556330
1640700129
1863374167
1324097651
1923803667
676334965
853386222

1571178311