php-internal-docs 8.4.8
Unofficial docs for php/php-src
Loading...
Searching...
No Matches
random.stub.php
Go to the documentation of this file.
1<?php
2
4
5namespace {
10 const MT_RAND_MT19937 = UNKNOWN;
16 const MT_RAND_PHP = UNKNOWN;
17
18 #[\Deprecated(since: '8.4', message: "use \\Random\\Randomizer::getFloat() instead")]
19 function lcg_value(): float {}
20
21 function mt_srand(?int $seed = null, int $mode = MT_RAND_MT19937): void {}
22
24 function srand(?int $seed = null, int $mode = MT_RAND_MT19937): void {}
25
26 function rand(int $min = UNKNOWN, int $max = UNKNOWN): int {}
27
28 function mt_rand(int $min = UNKNOWN, int $max = UNKNOWN): int {}
29
31
34
36 function random_bytes(int $length): string {}
37
38 function random_int(int $min, int $max): int {}
39}
40
41namespace Random\Engine
42{
45 */
46 final class Mt19937 implements \Random\Engine
47 {
48 public function __construct(int|null $seed = null, int $mode = MT_RAND_MT19937) {}
50 public function generate(): string {}
52 public function __serialize(): array {}
54 public function __unserialize(array $data): void {}
56 public function __debugInfo(): array {}
57 }
58
61 */
62 final class PcgOneseq128XslRr64 implements \Random\Engine
63 {
64 public function __construct(string|int|null $seed = null) {}
65
67 public function generate(): string {}
69 public function jump(int $advance): void {}
70
72 public function __serialize(): array {}
73
75 public function __unserialize(array $data): void {}
76
78 public function __debugInfo(): array {}
79 }
80
83 */
84 final class Xoshiro256StarStar implements \Random\Engine
85 {
86 public function __construct(string|int|null $seed = null) {}
87
89 public function generate(): string {}
91 public function jump(): void {}
93 public function jumpLong(): void {}
94
96 public function __serialize(): array {}
97
99 public function __unserialize(array $data): void {}
100
102 public function __debugInfo(): array {}
103 }
104
108 */
109 final class Secure implements \Random\CryptoSafeEngine
110 {
112 public function generate(): string {}
113 }
114}
115
116namespace Random
118 interface Engine
120 public function generate(): string;
121 }
123 interface CryptoSafeEngine extends Engine
124 {
125 }
126
129 */
130 final class Randomizer
132 public readonly Engine $engine;
134 public function __construct(?Engine $engine = null) {}
136 public function nextInt(): int {}
138 public function nextFloat(): float {}
140 public function getFloat(float $min, float $max, IntervalBoundary $boundary = IntervalBoundary::ClosedOpen): float {}
142 public function getInt(int $min, int $max): int {}
144 public function getBytes(int $length): string {}
146 public function getBytesFromString(string $string, int $length): string {}
148 public function shuffleArray(array $array): array {}
150 public function shuffleBytes(string $bytes): string {}
152 public function pickArrayKeys(array $array, int $num): array {}
154 public function __serialize(): array {}
156 public function __unserialize(array $data): void {}
157 }
159 enum IntervalBoundary {
160 case ClosedOpen;
161 case ClosedClosed;
162 case OpenClosed;
163 case OpenOpen;
164 }
165
168 */
169 class RandomError extends \Error
170 {
171 }
172
175 */
177 {
178 }
179
182 */
183 class RandomException extends \Exception
184 {
185 }
186}
__construct(int|null $seed=null, int $mode=MT_RAND_MT19937)
__unserialize(array $data)
__construct(string|int|null $seed=null)
__construct(string|int|null $seed=null)
shuffleArray(array $array)
getInt(int $min, int $max)
pickArrayKeys(array $array, int $num)
getFloat(float $min, float $max, IntervalBoundary $boundary=IntervalBoundary::ClosedOpen)
readonly Engine $engine
getBytesFromString(string $string, int $length)
__construct(?Engine $engine=null)
getBytes(int $length)
__unserialize(array $data)
shuffleBytes(string $bytes)
$data
Definition bench.php:6
phar_globals readonly
Definition phar.c:3346
@ MT_RAND_PHP
Definition php_random.h:54
@ MT_RAND_MT19937
Definition php_random.h:53
mt_srand(?int $seed=null, int $mode=MT_RAND_MT19937)
mt_getrandmax()
mt_rand(int $min=UNKNOWN, int $max=UNKNOWN)
lcg_value()
srand(?int $seed=null, int $mode=MT_RAND_MT19937)
getrandmax()
random_bytes(int $length)
random_int(int $min, int $max)
rand(int $min=UNKNOWN, int $max=UNKNOWN)
$array
Definition test.php:58
ZEND_API void(ZEND_FASTCALL *zend_touch_vm_stack_data)(void *vm_stack_data)
function(EX_VAR(opline->result.var))