Dre4m Shell
Server IP : 85.214.239.14  /  Your IP : 18.220.226.147
Web Server : Apache/2.4.62 (Debian)
System : Linux h2886529.stratoserver.net 4.9.0 #1 SMP Tue Jan 9 19:45:01 MSK 2024 x86_64
User : www-data ( 33)
PHP Version : 7.4.18
Disable Function : pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_get_handler,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,pcntl_async_signals,pcntl_unshare,
MySQL : OFF  |  cURL : OFF  |  WGET : ON  |  Perl : ON  |  Python : ON  |  Sudo : ON  |  Pkexec : OFF
Directory :  /proc/3/cwd/proc/3/root/usr/lib/node_modules/npm/node_modules/fastest-levenshtein/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ HOME SHELL ]     

Current File : /proc/3/cwd/proc/3/root/usr/lib/node_modules/npm/node_modules/fastest-levenshtein/test.js
var _a = require("./mod.js"), closest = _a.closest, distance = _a.distance;
var levenshtein = function (a, b) {
    if (a.length === 0) {
        return b.length;
    }
    if (b.length === 0) {
        return a.length;
    }
    if (a.length > b.length) {
        var tmp = a;
        a = b;
        b = tmp;
    }
    var row = [];
    for (var i = 0; i <= a.length; i++) {
        row[i] = i;
    }
    for (var i = 1; i <= b.length; i++) {
        var prev = i;
        for (var j = 1; j <= a.length; j++) {
            var val = 0;
            if (b.charAt(i - 1) === a.charAt(j - 1)) {
                val = row[j - 1];
            }
            else {
                val = Math.min(row[j - 1] + 1, prev + 1, row[j] + 1);
            }
            row[j - 1] = prev;
            prev = val;
        }
        row[a.length] = prev;
    }
    return row[a.length];
};
var makeid = function (length) {
    var result = "";
    var characters = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";
    var charactersLength = characters.length;
    for (var i = 0; i < length; i++) {
        result += characters.charAt(Math.floor(Math.random() * charactersLength));
    }
    return result;
};
for (var i = 0; i < 10000; i++) {
    var rnd_num1 = (Math.random() * 1000) | 0;
    var rnd_num2 = (Math.random() * 1000) | 0;
    var rnd_string1 = makeid(rnd_num1);
    var rnd_string2 = makeid(rnd_num2);
    var actual = distance(rnd_string1, rnd_string2);
    var expected = levenshtein(rnd_string1, rnd_string2);
    console.log(i);
    if (actual !== expected) {
        console.log("fail");
    }
}

Anon7 - 2022
AnonSec Team