FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
php-src/ext/random/tests/02_engine/all_serialize_native.phpt at master · php/php-src · GitHub
Uh oh!
There was an error while loading.
Please reload this page
.
php
/
php-src
Public
Notifications
You must be signed in to change notification settings
Fork
8.1k
Star
40.4k
Code
Issues
969
Pull requests
1.1k
Actions
Security and quality
52
Insights
Additional navigation options
Code
Issues
Pull requests
Actions
Security and quality
Insights
Expand file tree
Breadcrumbs
php-src
/
ext
/
random
/
tests
/
02_engine
/
all_serialize_native.phpt
Copy path
More file actions
More file actions
Latest commit
History
History
History
38 lines (30 loc) · 826 Bytes
Breadcrumbs
php-src
/
ext
/
random
/
tests
/
02_engine
/
all_serialize_native.phpt
Copy path
File metadata and controls
38 lines (30 loc) · 826 Bytes
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
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
--TEST--
Random: Engine: Serialization of native engines must preserve the sequence
--FILE--
<?php
use
Random
\
Engine
\
Mt19937
;
use
Random
\
Engine
\
PcgOneseq128XslRr64
;
use
Random
\
Engine
\
Xoshiro256StarStar
;
$
engines
= [];
$
engines
[] =
new
Mt19937
(
1234
);
$
engines
[] =
new
PcgOneseq128XslRr64
(
1234
);
$
engines
[] =
new
Xoshiro256StarStar
(
1234
);
foreach
(
$
engines
as
$
engine
) {
echo
$
engine
::class,
PHP_EOL
;
for
(
$
i
=
0
;
$
i
<
10_000
;
$
i
++) {
$
engine
->
generate
();
}
$
engine2
=
unserialize
(
serialize
(
$
engine
));
for
(
$
i
=
0
;
$
i
<
10_000
;
$
i
++) {
if
(
$
engine
->
generate
() !==
$
engine2
->
generate
()) {
die
(
"
failure: state differs at
{
$
i
}"
);
}
}
}
die
(
'
success
'
);
?>
--EXPECT--
Random\Engine\Mt19937
Random\Engine\PcgOneseq128XslRr64
Random\Engine\Xoshiro256StarStar
success
Back
|
FazBrowse Home
|
New Git URL