Skip to content

Commit 057af03

Browse files
authored
random sync with EN (#2235)
1 parent 6a5e96b commit 057af03

File tree

9 files changed

+41
-53
lines changed

9 files changed

+41
-53
lines changed

reference/random/book.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<?xml version="1.0" encoding="utf-8"?>
2-
<!-- EN-Revision: 550b9c3c31a66c18c9303794c12260bf5c684fed Maintainer: pierrick Status: ready -->
2+
<!-- EN-Revision: 1bcc40f8134305cbebf6c8378ee7e5fc8c569674 Maintainer: pierrick Status: ready -->
33
<!-- Reviewed: no -->
4-
<book xml:id="book.random" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
4+
<book xml:id="book.random" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" annotations="interactive">
55
<?phpdoc extension-membership="core" ?>
66
<title>Générateurs de nombres aléatoires et fonctions liées à l'aléatoire.</title>
77
<titleabbrev>Random</titleabbrev>

reference/random/examples.xml

Lines changed: 25 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<?xml version="1.0" encoding="utf-8"?>
2-
<!-- EN-Revision: 2166824858a40ea664c558f2930b63b8f4fd89c6 Maintainer: pierrick Status: ready -->
2+
<!-- EN-Revision: 1bcc40f8134305cbebf6c8378ee7e5fc8c569674 Maintainer: pierrick Status: ready -->
33
<!-- Reviewed: no -->
44
<chapter xml:id="random.examples" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
55
&reftitle.examples;
@@ -8,16 +8,38 @@
88
<programlisting role="php">
99
<![CDATA[
1010
<?php
11+
$r = new \Random\Randomizer();
1112
12-
/* ... */
13+
// Generating a random domain name
14+
printf(
15+
"%s.example.com\n",
16+
$r->getBytesFromString('abcdefghijklmnopqrstuvwxyz0123456789', 16)
17+
);
1318
19+
// Shuffle array:
20+
$fruits = [ 'red' => '🍎', 'green' => '🥝', 'yellow' => '🍌', 'pink' => '🍑', 'purple' => '🍇' ];
21+
echo "Salad: ", implode(', ', $r->shuffleArray($fruits)), "\n";
22+
23+
// Shuffeling array keys
24+
$fruits = [ 'red' => '🍎', 'green' => '🥝', 'yellow' => '🍌', 'pink' => '🍑', 'purple' => '🍇' ];
25+
26+
$keys = $r->pickArrayKeys($fruits, 2);
27+
// Look up the values for the picked keys.
28+
$selection = array_map(
29+
static fn ($key) => $fruits[$key],
30+
$keys
31+
);
32+
33+
echo "Values: ", implode(', ', $selection), "\n";
1434
?>
1535
]]>
1636
</programlisting>
1737
&example.outputs.similar;
1838
<screen>
1939
<![CDATA[
20-
...
40+
j87fzv1p0daiwmlo.example.com
41+
Salad: 🥝, 🍇, 🍎, 🍌, 🍑
42+
Values: 🍌, 🍑
2143
]]>
2244
</screen>
2345
</example>

reference/random/random/engine/mt19937/construct.xml

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<?xml version="1.0" encoding="utf-8"?>
2-
<!-- EN-Revision: c4f24e2eef1a3c970c491c0ee8cbc1f290ff023a Maintainer: Fan2Shrek Status: ready -->
2+
<!-- EN-Revision: 1bcc40f8134305cbebf6c8378ee7e5fc8c569674 Maintainer: Fan2Shrek Status: ready -->
33
<!-- Reviewed: yes -->
44
<refentry xml:id="random-engine-mt19937.construct" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
55
<refnamediv>
@@ -19,9 +19,6 @@
1919
</para>
2020

2121
&caution.mt19937-tiny-seed;
22-
23-
&warn.undocumented.func;
24-
2522
</refsect1>
2623

2724
<refsect1 role="parameters">
@@ -79,7 +76,7 @@
7976

8077
<refsect1 role="examples">
8178
&reftitle.examples;
82-
<example>
79+
<example annotations="non-interactive">
8380
<title>Exemple de <function>Random\Engine\Mt19937::__construct</function></title>
8481
<programlisting role="php">
8582
<![CDATA[

reference/random/random/engine/pcgoneseq128xslrr64/construct.xml

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<?xml version="1.0" encoding="utf-8"?>
2-
<!-- EN-Revision: 826073522514072830b63bee2b6135dc675ea45d Maintainer: Fan2Shrek Status: ready -->
2+
<!-- EN-Revision: 1bcc40f8134305cbebf6c8378ee7e5fc8c569674 Maintainer: Fan2Shrek Status: ready -->
33
<!-- Reviewed: yes -->
44
<refentry xml:id="random-engine-pcgoneseq128xslrr64.construct" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
55
<refnamediv>
@@ -16,9 +16,6 @@
1616
<para>
1717

1818
</para>
19-
20-
&warn.undocumented.func;
21-
2219
</refsect1>
2320

2421
<refsect1 role="parameters">
@@ -94,7 +91,7 @@
9491

9592
<refsect1 role="examples">
9693
&reftitle.examples;
97-
<example>
94+
<example annotations="non-interactive">
9895
<title>Exemple de <function>Random\Engine\PcgOneseq128XslRr64::__construct</function></title>
9996
<programlisting role="php">
10097
<![CDATA[

reference/random/random/engine/xoshiro256starstar/construct.xml

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<?xml version="1.0" encoding="utf-8"?>
2-
<!-- EN-Revision: 826073522514072830b63bee2b6135dc675ea45d Maintainer: Fan2Shrek Status: ready -->
2+
<!-- EN-Revision: 1bcc40f8134305cbebf6c8378ee7e5fc8c569674 Maintainer: Fan2Shrek Status: ready -->
33
<!-- Reviewed: yes -->
44
<refentry xml:id="random-engine-xoshiro256starstar.construct" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
55
<refnamediv>
@@ -16,9 +16,6 @@
1616
<para>
1717

1818
</para>
19-
20-
&warn.undocumented.func;
21-
2219
</refsect1>
2320

2421
<refsect1 role="parameters">
@@ -100,7 +97,7 @@
10097

10198
<refsect1 role="examples">
10299
&reftitle.examples;
103-
<example>
100+
<example annotations="non-interactive">
104101
<title>Exemple de <function>Random\Engine\Xoshiro256StarStar::__construct</function></title>
105102
<programlisting role="php">
106103
<![CDATA[

reference/random/random/randomizer/construct.xml

Lines changed: 4 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<?xml version="1.0" encoding="utf-8"?>
2-
<!-- EN-Revision: 5e2031dc70157464c05c1c1e00b3201604a025f1 Maintainer: Fan2Shrek Status: ready -->
2+
<!-- EN-Revision: 1bcc40f8134305cbebf6c8378ee7e5fc8c569674 Maintainer: Fan2Shrek Status: ready -->
33
<!-- Reviewed: yes -->
44
<refentry xml:id="random-randomizer.construct" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
55
<refnamediv>
@@ -39,37 +39,18 @@
3939
</variablelist>
4040
</refsect1>
4141

42-
<!-- Return values commented out, as constructors generally don't return a
43-
value. Uncomment this if you do need a return values section (for
44-
example, because there's also a procedural version of the method).
45-
<refsect1 role="returnvalues">
46-
&reftitle.returnvalues;
47-
<para>
48-
49-
</para>
50-
</refsect1>
51-
-->
52-
53-
5442
<refsect1 role="examples">
5543
&reftitle.examples;
56-
<example>
44+
<example annotations="non-interactive">
5745
<title>Exemple de <function>Random\Randomizer::__construct</function></title>
5846
<programlisting role="php">
5947
<![CDATA[
6048
<?php
61-
62-
/* ... */
63-
49+
$r = new \Random\Randomizer();
50+
$r = new \Random\Randomizer(new \Random\Engine\Mt19937());
6451
?>
6552
]]>
6653
</programlisting>
67-
&example.outputs.similar;
68-
<screen>
69-
<![CDATA[
70-
...
71-
]]>
72-
</screen>
7354
</example>
7455
</refsect1>
7556

reference/random/random/randomizer/getint.xml

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<?xml version="1.0" encoding="utf-8"?>
2-
<!-- EN-Revision: 0ec8e36e0f649354b20c714080a903d32df4dbfb Maintainer: Fan2Shrek Status: ready -->
2+
<!-- EN-Revision: 1bcc40f8134305cbebf6c8378ee7e5fc8c569674 Maintainer: Fan2Shrek Status: ready -->
33
<!-- Reviewed: yes -->
44
<refentry xml:id="random-randomizer.getint" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
55
<refnamediv>
@@ -17,9 +17,6 @@
1717
<para>
1818

1919
</para>
20-
21-
&warn.undocumented.func;
22-
2320
</refsect1>
2421

2522
<refsect1 role="parameters">

reference/random/random/randomizer/nextint.xml

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<?xml version="1.0" encoding="utf-8"?>
2-
<!-- EN-Revision: 788ec8e5e7bdadd182e52d4820959e21765d7ff3 Maintainer: Fan2Shrek Status: ready -->
2+
<!-- EN-Revision: 1bcc40f8134305cbebf6c8378ee7e5fc8c569674 Maintainer: Fan2Shrek Status: ready -->
33
<!-- Reviewed: yes -->
44
<refentry xml:id="random-randomizer.nextint" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
55
<refnamediv>
@@ -16,9 +16,6 @@
1616
<para>
1717

1818
</para>
19-
20-
&warn.undocumented.func;
21-
2219
</refsect1>
2320

2421
<refsect1 role="parameters">

reference/reflection/book.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<?xml version="1.0" encoding="utf-8"?>
2-
<!-- EN-Revision: e0e74c05cb704b614ff6925552884fbffb26bb53 Maintainer: yannick Status: ready -->
2+
<!-- EN-Revision: 1bcc40f8134305cbebf6c8378ee7e5fc8c569674 Maintainer: yannick Status: ready -->
33
<!-- Reviewed: no -->
4-
<book xml:id="book.reflection" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
4+
<book xml:id="book.reflection" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" annotations="interactive">
55
<?phpdoc extension-membership="core" ?>
66
<title>Réflexion</title>
77
<titleabbrev>Réflexion</titleabbrev>

0 commit comments

Comments
 (0)