Skip to content

Commit 4fbb4d4

Browse files
committed
Implove create random strings
1 parent d27cfa0 commit 4fbb4d4

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

ext/mbstring/tests/mb_levenshtein.phpt

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,10 @@ var_dump(mb_levenshtein("cafe", $cafe, encoding: "ISO-8859-1"));
5959
echo '--- Usecase of userland code ---' . \PHP_EOL;
6060

6161
for ($i = 0; $i < 100; $i++) {
62-
$bytes = implode("", array_map(function ($byte) { return mb_chr(intval(bin2hex($byte), 16), "UTF-8"); }, str_split(random_bytes(10))));
62+
$bytes = "";
63+
for ($j = 0; $j < 10; $j++) {
64+
$bytes .= mb_chr(mt_rand(0, 0x10FFF));
65+
}
6366
$compare = "あいうえおABCDEF";
6467
if (mb_levenshtein($bytes, $compare) !== keinos_mb_levenshtein($bytes, $compare)) {
6568
throw Exception("mb_levenshtein compare error: {$bytes}");

0 commit comments

Comments
 (0)