Random line detection

I need to check if the string is quite random without performing a frequency analysis, because it will be too long. Is there such an algorithm already there? I create this using java, but a general description of the algorithm will also be useful.

Explanation: For the human eye, the following text is somehow random .... dsfsddsfdsfsddsfs .... or even po340-3gk30g3gkf; glkp.

I do not want to know exactly how arbitrary it is. I just want to discover, to a large extent, how a person will be if the string is random, without measuring its actual randomness.

+3
source share
3 answers

I need to check if a string is quite random without performing frequency analysis, because it will be too time consuming.

- , , , . ( ) .

, " ", .

, , . , . , "" , , , .

:

String str = "                      o         _        _            _        "
           + "           _o        /\_      _ \\o     (_)\__/o     (_)       "
           + "         _< \_      _>(_)    (_)/<_       \_| \      _|/' \/   "
           + "        (_)>(_)    (_)           (_)      (_)       (_)'  _\o_ ";

, , .

+6

. gzip .

, . - , . gzip, ilk "" .

, " ", .

gzip , , , , -, (.. , length(a short string) < length(compress(a short string))), , length(compress(a short repetitive string)) < length(compress(a short non-repetitive string)), , , , .

+4

You can either analyze the algorithm that generates Strings, or do a frequency analysis. But I believe that there is no way to determine if String is pretty random.

Is "13530168 = dwninwebvp" pretty random?

0
source

Source: https://habr.com/ru/post/1793557/


All Articles