-
Notifications
You must be signed in to change notification settings - Fork 112
Expand file tree
/
Copy path386_random_int.php
More file actions
42 lines (30 loc) · 1.01 KB
/
386_random_int.php
File metadata and controls
42 lines (30 loc) · 1.01 KB
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
@ok php8
<?php
function test_random_int() {
$x = random_int(-1, 0);
var_dump($x >= -1 && $x <= 0);
$x = random_int(-1, 1);
var_dump($x >= -1 && $x <= 1);
$x = random_int(0, 1);
var_dump($x >= 0 && $x <= 1);
$x = random_int(100, 500);
var_dump($x >= 100 && $x <= 500);
$x = random_int(-450, -200);
var_dump($x >= -450 && $x <= -200);
$x = random_int(-124, 107);
var_dump($x >= -124 && $x <= 107);
$x = random_int(0, PHP_INT_MAX);
var_dump($x >= 0 && $x <= PHP_INT_MAX);
$x = random_int(-PHP_INT_MAX - 1, 0);
var_dump($x >= -PHP_INT_MAX - 1 && $x <= 0);
$x = random_int(-PHP_INT_MAX - 1, PHP_INT_MAX);
var_dump($x >= (-PHP_INT_MAX - 1) && $x <= PHP_INT_MAX);
var_dump(random_int(0, 0));
var_dump(random_int(1, 1));
var_dump(random_int(-4, -4));
var_dump(random_int(9287167122323, 9287167122323));
var_dump(random_int(-8548276162, -8548276162));
var_dump(random_int(PHP_INT_MAX, PHP_INT_MAX));
var_dump(random_int(-PHP_INT_MAX - 1, -PHP_INT_MAX - 1));
}
test_random_int();