{"id":381205,"date":"2024-06-29T03:32:19","date_gmt":"2024-06-29T03:32:19","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=381205"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=381205","title":{"rendered":"<span>\u0412\u0437\u043b\u043e\u043c \u0413\u041f\u0421\u0427 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u043c\u0430\u0448\u0438\u043d\u043d\u043e\u0433\u043e \u043e\u0431\u0443\u0447\u0435\u043d\u0438\u044f<\/span>"},"content":{"rendered":"<div><!--[--><!--]--><\/div>\n<div id=\"post-content-body\">\n<div>\n<div class=\"article-formatted-body article-formatted-body article-formatted-body_version-1\">\n<div xmlns=\"http:\/\/www.w3.org\/1999\/xhtml\">\n<div style=\"text-align:center;\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w780q1\/webt\/cp\/w8\/z-\/cpw8z-ucbhbebw0micqndtz4wee.jpeg\" data-src=\"https:\/\/habrastorage.org\/webt\/cp\/w8\/z-\/cpw8z-ucbhbebw0micqndtz4wee.jpeg\" data-blurred=\"true\"\/><\/div>\n<p>  <i>\u0412\u044b\u0434\u0430\u0447\u0430 XORShift \u043a\u0430\u0436\u0435\u0442\u0441\u044f \u0441\u043b\u0443\u0447\u0430\u0439\u043d\u043e\u0439<\/i> <\/p>\n<p>  \u0418\u0441\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c \u041c\u043e\u0441\u0442\u0430\u0444\u0430 \u0425\u0430\u0441\u0441\u0430\u043d (Mostafa Hassan) <a href=\"https:\/\/research.nccgroup.com\/2021\/10\/15\/cracking-random-number-generators-using-machine-learning-part-1-xorshift128\/\">\u0441\u0443\u043c\u0435\u043b \u0432\u0437\u043b\u043e\u043c\u0430\u0442\u044c<\/a> \u0434\u0432\u0430 \u0433\u0435\u043d\u0435\u0440\u0430\u0442\u043e\u0440\u0430 \u043f\u0441\u0432\u0435\u0434\u043e\u0441\u043b\u0443\u0447\u0430\u0439\u043d\u044b\u0445 \u0447\u0438\u0441\u0435\u043b (\u0413\u041f\u0421\u0427) \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u043c\u0430\u0448\u0438\u043d\u043d\u043e\u0433\u043e \u043e\u0431\u0443\u0447\u0435\u043d\u0438\u044f. \u041e\u0431\u0443\u0447\u0435\u043d\u043d\u0430\u044f \u0434\u0432\u0443\u0441\u043b\u043e\u0439\u043d\u0430\u044f \u043d\u0435\u0439\u0440\u043e\u0441\u0435\u0442\u044c \u043f\u0440\u0435\u0434\u0441\u043a\u0430\u0437\u0430\u043b\u0430 \u0432\u044b\u0434\u0430\u0447\u0443 \u0433\u0435\u043d\u0435\u0440\u0430\u0442\u043e\u0440\u0430 xorshift128 \u0441 \u0442\u043e\u0447\u043d\u043e\u0441\u0442\u044c\u044e 100%.<\/p>\n<p>  \u0412\u043e <a href=\"https:\/\/research.nccgroup.com\/2021\/10\/18\/cracking-random-number-generators-using-machine-learning-part-2-mersenne-twister\/\">\u0432\u0442\u043e\u0440\u043e\u0439 \u0447\u0430\u0441\u0442\u0438<\/a> \u0441\u0432\u043e\u0435\u0439 \u0440\u0430\u0431\u043e\u0442\u044b \u041c\u043e\u0441\u0442\u0430\u0444\u0430 \u043e\u043f\u0438\u0441\u0430\u043b \u0435\u0449\u0451 \u043e\u0434\u043d\u0443 \u043d\u0435\u0439\u0440\u043e\u0441\u0435\u0442\u044c, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u0432\u0437\u043b\u043e\u043c\u0430\u043b\u0430 \u043f\u043e\u043f\u0443\u043b\u044f\u0440\u043d\u044b\u0439 \u0433\u0435\u043d\u0435\u0440\u0430\u0442\u043e\u0440 Mersenne Twister (\u0432\u0438\u0445\u0440\u044c \u041c\u0435\u0440\u0441\u0435\u043d\u043d\u0430, MT, MT19937) \u0442\u043e\u0436\u0435 \u0441 \u0442\u043e\u0447\u043d\u043e\u0441\u0442\u044c\u044e 100%.<br \/>  <a name=\"habracut\"><\/a>  <\/p>\n<h1>\u0412\u0437\u043b\u043e\u043c xorshift128<\/h1>\n<p>  \u0413\u0435\u043d\u0435\u0440\u0430\u0442\u043e\u0440\u044b \u0442\u0438\u043f\u0430 XORShift \u044f\u0432\u043b\u044f\u044e\u0442\u0441\u044f \u043e\u0434\u043d\u0438\u043c\u0438 \u0438\u0437 \u0441\u0430\u043c\u044b\u0445 \u0431\u044b\u0441\u0442\u0440\u044b\u0445 \u043a\u0440\u0438\u043f\u0442\u043e\u0433\u0440\u0430\u0444\u0438\u0447\u0435\u0441\u043a\u0438 \u043d\u0435\u0441\u0442\u043e\u0439\u043a\u0438\u0445 \u0433\u0435\u043d\u0435\u0440\u0430\u0442\u043e\u0440\u043e\u0432 \u0441\u043b\u0443\u0447\u0430\u0439\u043d\u044b\u0445 \u0447\u0438\u0441\u0435\u043b, \u0430 \u0438\u0445 \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f \u043d\u0435 \u043f\u0440\u0435\u0434\u043f\u043e\u043b\u0430\u0433\u0430\u0435\u0442 \u0431\u043e\u043b\u044c\u0448\u0438\u0445 \u043e\u0431\u044a\u0451\u043c\u043e\u0432 \u043a\u043e\u0434\u0430, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u043e\u043d\u0438 \u0447\u0430\u0441\u0442\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e\u0442\u0441\u044f \u0432 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u043d\u043e\u043c \u043e\u0431\u0435\u0441\u043f\u0435\u0447\u0435\u043d\u0438\u0438. \u0418\u043d\u043e\u0433\u0434\u0430 \u0438\u0445 \u043e\u0448\u0438\u0431\u043e\u0447\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e\u0442 \u0432\u043c\u0435\u0441\u0442\u043e \u043a\u0440\u0438\u043f\u0442\u043e\u0433\u0440\u0430\u0444\u0438\u0447\u0435\u0441\u043a\u0438 \u0441\u0442\u043e\u0439\u043a\u0438\u0445 \u0413\u041f\u0421\u0427.<\/p>\n<p>  \u041a\u0430\u043a \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 xorshift128? \u041a\u043e\u0434 \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u0430 \u043c\u043e\u0436\u043d\u043e \u043d\u0430\u0439\u0442\u0438 \u043d\u0430 \u0412\u0438\u043a\u0438\u043f\u0435\u0434\u0438\u0438 \u0438 \u0432 <a href=\"https:\/\/github.com\/airza\/RngPredictor\">\u0440\u0435\u043f\u043e\u0437\u0438\u0442\u043e\u0440\u0438\u0438 \u043d\u0430 Github<\/a>:<\/p>\n<pre><code class=\"python\">def xorshift128():     '''xorshift     https:\/\/ja.wikipedia.org\/wiki\/Xorshift     '''      x = 123456789     y = 362436069     z = 521288629     w = 88675123      def _random():         nonlocal x, y, z, w         t = x ^ ((x &lt;&lt; 11) &amp; 0xFFFFFFFF)  # 32bit         x, y, z = y, z, w         w = (w ^ (w >> 19)) ^ (t ^ (t >> 8))         return w      return _random<\/code><\/pre>\n<p>  \u0418\u043c\u0435\u043d\u043d\u043e \u044d\u0442\u0430 \u0444\u0443\u043d\u043a\u0446\u0438\u044f \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043b\u0430\u0441\u044c \u0432 \u043c\u043e\u0434\u0435\u043b\u0438 \u043c\u0430\u0448\u0438\u043d\u043d\u043e\u0433\u043e \u043e\u0431\u0443\u0447\u0435\u043d\u0438\u044f (ML).<\/p>\n<p>  \u041a\u0430\u043a \u0432\u0438\u0434\u0438\u043c \u0438\u0437 \u043a\u043e\u0434\u0430, \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f \u0434\u043e\u0432\u043e\u043b\u044c\u043d\u043e \u043f\u0440\u043e\u0441\u0442\u0430\u044f. \u0423 \u043d\u0435\u0451 \u0447\u0435\u0442\u044b\u0440\u0435 \u0432\u043d\u0443\u0442\u0440\u0435\u043d\u043d\u0438\u0445 \u0447\u0438\u0441\u043b\u0430, <b>x<\/b>, <b>y<\/b>, <b>z<\/b> \u0438 <b>w<\/b>, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043e\u0434\u043d\u043e\u0432\u0440\u0435\u043c\u0435\u043d\u043d\u043e \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u044f\u044e\u0442 \u0441\u0438\u0434 \u0438 \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0435 \u0413\u041f\u0421\u0427. \u041a\u043e\u043d\u0435\u0447\u043d\u043e, \u043c\u043e\u0436\u043d\u043e \u0438\u0437\u043c\u0435\u043d\u0438\u0442\u044c \u044d\u0442\u043e\u0442 \u043a\u043e\u0434, \u0447\u0442\u043e\u0431\u044b \u0432\u043c\u0435\u0441\u0442\u043e \u0436\u0435\u0441\u0442\u043a\u043e\u0433\u043e \u043a\u043e\u0434\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u0441\u0438\u0434\u0430 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u043a\u0430\u043a\u043e\u0439-\u043d\u0438\u0431\u0443\u0434\u044c \u0432\u044b\u0437\u043e\u0432 \u0444\u0443\u043d\u043a\u0446\u0438\u0438. \u041a\u0430\u0436\u0434\u044b\u0439 \u0440\u0430\u0437, \u043a\u043e\u0433\u0434\u0430 \u043c\u044b \u0432\u044b\u0437\u044b\u0432\u0430\u0435\u043c \u0433\u0435\u043d\u0435\u0440\u0430\u0442\u043e\u0440, \u043e\u043d \u0431\u0443\u0434\u0435\u0442 \u0441\u0434\u0432\u0438\u0433\u0430\u0442\u044c \u0432\u043d\u0443\u0442\u0440\u0435\u043d\u043d\u0438\u0435 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0435 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c: <b>y -> x<\/b>, <b>z -> y<\/b> \u0438 <b>w -> z<\/b>. \u041d\u043e\u0432\u043e\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 <b>w<\/b> \u043e\u0446\u0435\u043d\u0438\u0432\u0430\u0435\u0442\u0441\u044f \u043f\u0443\u0442\u0451\u043c \u043f\u0440\u0438\u043c\u0435\u043d\u0435\u043d\u0438\u044f \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u0431\u0438\u0442\u043e\u0432\u044b\u0445 \u043c\u0430\u043d\u0438\u043f\u0443\u043b\u044f\u0446\u0438\u0439 (\u0441\u0434\u0432\u0438\u0433\u043e\u0432 \u0438 XOR) \u043a \u0441\u0442\u0430\u0440\u044b\u043c \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f\u043c <b>x<\/b> \u0438 <b>w<\/b>. \u041d\u043e\u0432\u043e\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 <b>w<\/b> \u0437\u0430\u0442\u0435\u043c \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442\u0441\u044f \u043a\u0430\u043a \u043d\u043e\u0432\u043e\u0435 \u0441\u043b\u0443\u0447\u0430\u0439\u043d\u043e\u0435 \u0447\u0438\u0441\u043b\u043e \u043d\u0430 \u0432\u044b\u0445\u043e\u0434\u0435 \u0433\u0435\u043d\u0435\u0440\u0430\u0442\u043e\u0440\u0430 \u0441\u043b\u0443\u0447\u0430\u0439\u043d\u044b\u0445 \u0447\u0438\u0441\u0435\u043b. <\/p>\n<p>  \u041d\u0430 \u0441\u0445\u0435\u043c\u0435 \u043d\u0438\u0436\u0435 \u041e<sub>0<\/sub>, \u041e<sub>1<\/sub>, \u041e<sub>2<\/sub> \u0438 \u0442\u0430\u043a \u0434\u0430\u043b\u0435\u0435\u00a0\u2014 \u044d\u0442\u043e \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442 \u0432\u044b\u0447\u0438\u0441\u043b\u0435\u043d\u0438\u0439 \u0441 \u0432\u044b\u0448\u0435\u0443\u043f\u043e\u043c\u044f\u043d\u0443\u0442\u044b\u043c\u0438 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u043c\u0438:<\/p>\n<p>  <code>O<sub>0<\/sub> = W<sub>0<\/sub> ^ W<sub>19<\/sub> ^ X<sub>0<\/sub> ^ X<sub>8<\/sub><br \/>  O<sub>1<\/sub> = W<sub>1<\/sub> ^ W<sub>20<\/sub> ^ X<sub>1<\/sub> ^ X<sub>9<\/sub><br \/>  .<br \/>  .<br \/>  O<sub>31<\/sub> = W<sub>31<\/sub> ^ X<sub>20<\/sub> ^ X<sub>31<\/sub><\/code><\/p>\n<p>  \u041f\u043e\u043b\u0443\u0447\u0430\u0435\u0442\u0441\u044f \u0442\u0430\u043a\u0430\u044f \u0441\u0445\u0435\u043c\u0430:<\/p>\n<div style=\"text-align:center;\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/webt\/1x\/zo\/x4\/1xzox462oovyqu6b2pjhw6gwjgw.png\" width=\"500\" data-src=\"https:\/\/habrastorage.org\/webt\/1x\/zo\/x4\/1xzox462oovyqu6b2pjhw6gwjgw.png\"\/><\/div>\n<p>  \u041a\u0430\u043a \u0432\u0438\u0434\u0438\u043c, \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 O \u0432\u044b\u0447\u0438\u0441\u043b\u044f\u0435\u0442\u0441\u044f \u043d\u0430 \u043e\u0441\u043d\u043e\u0432\u0435 \u0442\u043e\u043b\u044c\u043a\u043e \u0434\u0432\u0443\u0445 \u0447\u0438\u0441\u0435\u043b <b>x<\/b> \u0438 <b>w<\/b> (\u043a\u043e\u043d\u0435\u0447\u043d\u043e, \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f <b>y<\/b> \u0438 <b>z<\/b> \u0442\u043e\u0436\u0435 \u043f\u0440\u0435\u0434\u0432\u0430\u0440\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e\u0442\u0441\u044f).<\/p>\n<p>  \u041d\u0430 \u043f\u0435\u0440\u0432\u044b\u0439 \u0432\u0437\u0433\u043b\u044f\u0434 \u043a\u0430\u0436\u0435\u0442\u0441\u044f \u043a\u043e\u043d\u0442\u0440\u0438\u043d\u0442\u0443\u0438\u0442\u0438\u0432\u043d\u044b\u043c \u043e\u0431\u0443\u0447\u0430\u0442\u044c \u043d\u0435\u0439\u0440\u043e\u0441\u0435\u0442\u044c \u043d\u0430 \u043c\u0430\u0441\u0441\u0438\u0432\u0435 \u043f\u0441\u0435\u0432\u0434\u043e\u0441\u043b\u0443\u0447\u0430\u0439\u043d\u044b\u0445 \u0447\u0438\u0441\u0435\u043b, \u0432 \u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u043f\u043e \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u044e \u043d\u0435 \u0434\u043e\u043b\u0436\u043d\u043e \u0431\u044b\u0442\u044c \u043d\u0438\u043a\u0430\u043a\u0438\u0445 \u0437\u0430\u043a\u043e\u043d\u043e\u043c\u0435\u0440\u043d\u043e\u0441\u0442\u0435\u0439. \u0412 \u0442\u043e \u0436\u0435 \u0432\u0440\u0435\u043c\u044f \u043b\u044e\u0431\u0430\u044f ML-\u043c\u043e\u0434\u0435\u043b\u044c \u043e\u0431\u0443\u0447\u0430\u0435\u0442\u0441\u044f \u0438\u043c\u0435\u043d\u043d\u043e \u043d\u0430 \u043f\u0430\u0442\u0442\u0435\u0440\u043d\u0430\u0445 \u0434\u0430\u043d\u043d\u044b\u0445. \u0422\u0430\u043a\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c, \u043a\u0430\u043a \u0431\u0443\u0434\u0442\u043e \u043d\u0435\u0442 \u0441\u043c\u044b\u0441\u043b\u0430 \u043e\u0431\u0443\u0447\u0430\u0442\u044c \u0435\u0451 \u043d\u0430 \u0413\u041f\u0421\u0427, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043d\u0435 \u0434\u043e\u043b\u0436\u043d\u044b \u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u044c \u043f\u0430\u0442\u0442\u0435\u0440\u043d\u0430\u043c. \u0418 \u043d\u0435 \u0442\u043e\u043b\u044c\u043a\u043e \u043e\u0431\u0443\u0447\u0430\u0442\u044c\u0441\u044f, \u043d\u043e \u0438 \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u0442\u043e\u0447\u043d\u043e\u0441\u0442\u044c 100%.<\/p>\n<p>  \u041d\u043e \u044d\u0442\u043e \u0432\u0441\u0451-\u0442\u0430\u043a\u0438 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e. \u0421\u043b\u0430\u0431\u043e\u0441\u0442\u044c \u043f\u0440\u043e\u0441\u0442\u0435\u0439\u0448\u0438\u0445 \u0433\u0435\u043d\u0435\u0440\u0430\u0442\u043e\u0440\u043e\u0432 \u0442\u0438\u043f\u0430 XORShift \u0441\u043e\u0441\u0442\u043e\u0438\u0442 \u0432 \u0442\u043e\u043c, \u0447\u0442\u043e \u043a\u0430\u0436\u0434\u043e\u0435 \u043d\u043e\u0432\u043e\u0435 \u043f\u0441\u0435\u0432\u0434\u043e\u0441\u043b\u0443\u0447\u0430\u0439\u043d\u043e\u0435 \u0447\u0438\u0441\u043b\u043e \u0437\u0430\u0432\u0438\u0441\u0438\u0442 \u043e\u0442 \u0447\u0435\u0442\u044b\u0440\u0451\u0445 \u043f\u0440\u0435\u0434\u044b\u0434\u0443\u0449\u0438\u0445 \u0447\u0438\u0441\u0435\u043b, \u043a\u0430\u043a \u043f\u043e\u043a\u0430\u0437\u0430\u043d\u043e \u0432\u044b\u0448\u0435. \u042d\u0442\u043e \u0438 \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u043d\u0435\u0439\u0440\u043e\u0441\u0435\u0442\u0438 \u043f\u0440\u0435\u0434\u0441\u043a\u0430\u0437\u044b\u0432\u0430\u0442\u044c \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442, \u0434\u0430\u0436\u0435 \u043d\u0435 \u0437\u043d\u0430\u044f \u043d\u0430\u0447\u0430\u043b\u044c\u043d\u043e\u0433\u043e \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f (\u0441\u0438\u0434\u0430), \u0441 \u043a\u043e\u0442\u043e\u0440\u043e\u0433\u043e \u043d\u0430\u0447\u0438\u043d\u0430\u044e\u0442 \u0433\u0435\u043d\u0435\u0440\u0438\u0440\u043e\u0432\u0430\u0442\u044c\u0441\u044f \u0447\u0438\u0441\u043b\u0430.<\/p>\n<div style=\"text-align:center;\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/webt\/55\/3l\/lo\/553llotcx9bpkzmprgnxee9msxa.png\" data-src=\"https:\/\/habrastorage.org\/webt\/55\/3l\/lo\/553llotcx9bpkzmprgnxee9msxa.png\"\/><\/div>\n<p>  <i>\u0412 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u0438\u043b\u043b\u044e\u0441\u0442\u0440\u0430\u0446\u0438\u0438 \u00ab\u043f\u0440\u0435\u0434\u0441\u043a\u0430\u0437\u0443\u0435\u043c\u044b\u0445\u00bb \u0413\u041f\u0421\u0427\u00a0\u2014 <a href=\"https:\/\/en.wikipedia.org\/wiki\/Middle-square_method\">\u043c\u0435\u0442\u043e\u0434 \u0441\u0440\u0435\u0434\u043d\u0438\u0445 \u043a\u0432\u0430\u0434\u0440\u0430\u0442\u043e\u0432<\/a>, \u044d\u0442\u043e\u0442 \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c \u0414\u0436\u043e\u043d \u0444\u043e\u043d \u041d\u0435\u0439\u043c\u0430\u043d \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u0438\u043b \u043d\u0430 \u043a\u043e\u043d\u0444\u0435\u0440\u0435\u043d\u0446\u0438\u0438 \u043f\u043e \u043f\u0440\u0438\u043a\u043b\u0430\u0434\u043d\u043e\u0439 \u043c\u0430\u0442\u0435\u043c\u0430\u0442\u0438\u043a\u0435 \u0432 1949 \u0433\u043e\u0434\u0443<\/i> <\/p>\n<p>  \u041a\u0430\u043a \u043c\u0430\u0448\u0438\u043d\u043d\u043e\u0435 \u043e\u0431\u0443\u0447\u0435\u043d\u0438\u0435 \u043c\u043e\u0436\u0435\u0442 \u0432\u0437\u043b\u043e\u043c\u0430\u0442\u044c \u0413\u041f\u0421\u0427? \u041f\u043e \u0441\u0443\u0442\u0438, \u0432 \u0434\u0430\u043d\u043d\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a \u0437\u0430\u043a\u043e\u0434\u0438\u0440\u043e\u0432\u0430\u043b \u0431\u0438\u043d\u0430\u0440\u043d\u0443\u044e \u0441\u0445\u0435\u043c\u0443 xorshift128 \u0432 \u0432\u0438\u0434\u0435 \u043d\u0435\u0439\u0440\u043e\u043d\u043d\u043e\u0439 \u0441\u0435\u0442\u0438. \u0422\u043e\u0442 \u0444\u0430\u043a\u0442, \u0447\u0442\u043e \u0432\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u043a\u043e\u0434\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u043b\u044c\u043d\u044b\u0435 \u0434\u0432\u043e\u0438\u0447\u043d\u044b\u0435 \u0446\u0435\u043f\u0438 \u0432 \u0432\u0438\u0434\u0435 \u043d\u0435\u0439\u0440\u043e\u043d\u043d\u044b\u0445 \u0441\u0435\u0442\u0435\u0439, \u0445\u043e\u0440\u043e\u0448\u043e \u0438\u0437\u0432\u0435\u0441\u0442\u0435\u043d.<\/p>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/webt\/8v\/z0\/nf\/8vz0nfpfvr_mbfjrj4vmm1jhsva.png\" data-src=\"https:\/\/habrastorage.org\/webt\/8v\/z0\/nf\/8vz0nfpfvr_mbfjrj4vmm1jhsva.png\"\/><br \/>  <i>\u041f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 XOR \u0441 \u0434\u0432\u0443\u043c\u044f \u0432\u0445\u043e\u0434\u0430\u043c\u0438 \u0432 \u0434\u0432\u0443\u0441\u043b\u043e\u0439\u043d\u043e\u0439 \u043d\u0435\u0439\u0440\u043e\u0441\u0435\u0442\u0438<\/i> <\/p>\n<p>  \u0418\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u044b\u043c \u0438 \u043d\u0435\u043e\u0436\u0438\u0434\u0430\u043d\u043d\u044b\u043c \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u043e\u043c \u0438\u0441\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u043d\u0438\u044f \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0434\u0435\u043c\u043e\u043d\u0441\u0442\u0440\u0430\u0446\u0438\u044f, \u0447\u0442\u043e \u043c\u043e\u0436\u043d\u043e \u043e\u0431\u0443\u0447\u0438\u0442\u044c \u044d\u0442\u0443 \u0441\u0435\u0442\u044c, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044f \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u044b\u0435 \u0433\u0440\u0430\u0434\u0438\u0435\u043d\u0442\u043d\u044b\u0435 \u043c\u0435\u0442\u043e\u0434\u044b, \u0435\u0441\u043b\u0438 \u043f\u043e\u0434\u043e\u0431\u0440\u0430\u0442\u044c \u043f\u043e\u0434\u0445\u043e\u0434\u044f\u0449\u0443\u044e \u0444\u0443\u043d\u043a\u0446\u0438\u044e \u043f\u043e\u0442\u0435\u0440\u044c, \u0445\u043e\u0440\u043e\u0448\u043e \u043f\u043e\u043d\u0438\u043c\u0430\u0442\u044c \u0440\u0435\u0448\u0430\u0435\u043c\u0443\u044e \u0437\u0430\u0434\u0430\u0447\u0443 (\u0442\u043e \u0435\u0441\u0442\u044c \u043e\u0442\u043b\u0438\u0447\u043d\u043e \u043f\u043e\u043d\u0438\u043c\u0430\u0442\u044c \u043a\u0440\u0438\u043f\u0442\u043e\u0433\u0440\u0430\u0444\u0438\u044e)\u00a0\u2014 \u0438 \u0441\u043f\u0440\u043e\u0435\u043a\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0441\u0435\u0442\u044c \u0441 \u043f\u043e\u043d\u0438\u043c\u0430\u043d\u0438\u0435\u043c \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u0430, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043e\u043d\u0430 \u0434\u043e\u043b\u0436\u043d\u0430 \u043c\u043e\u0434\u0435\u043b\u0438\u0440\u043e\u0432\u0430\u0442\u044c. \u0414\u0440\u0443\u0433\u0438\u043c\u0438 \u0441\u043b\u043e\u0432\u0430\u043c\u0438, \u044d\u0442\u043e \u043c\u043e\u0436\u043d\u043e \u0440\u0430\u0441\u0441\u043c\u0430\u0442\u0440\u0438\u0432\u0430\u0442\u044c \u0432 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u043f\u0440\u0438\u043c\u0435\u0440\u0430, \u0447\u0442\u043e \u0433\u0440\u0430\u043c\u043e\u0442\u043d\u043e\u0435 \u043f\u0440\u043e\u0435\u043a\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u0441\u0435\u0442\u0438 \u0438 \u0432\u044b\u0431\u043e\u0440 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u043f\u043e\u0442\u0435\u0440\u044c \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0435\u043d\u043d\u043e \u0432\u043b\u0438\u044f\u0435\u0442 \u043d\u0430 \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u044c \u043d\u0435\u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u043e\u0439 ML-\u043c\u043e\u0434\u0435\u043b\u0438.<\/p>\n<p>  \u041a\u043e\u0434 \u0434\u043b\u044f \u043e\u0431\u0443\u0447\u0435\u043d\u0438\u044f \u0438 \u0442\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u043d\u0435\u0439\u0440\u043e\u0441\u0435\u0442\u0438, \u0432\u0437\u043b\u043e\u043c\u0430\u0432\u0448\u0435\u0439 xorshift128, \u043e\u043f\u0443\u0431\u043b\u0438\u043a\u043e\u0432\u0430\u043d <a href=\"https:\/\/github.com\/nccgroup\/ML-for-RNGs\/tree\/main\/rng_xorshift128\">\u0437\u0434\u0435\u0441\u044c<\/a>.<\/p>\n<p>  \u0427\u0442\u043e\u0431\u044b \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u044b xorshift128 \u0441\u0442\u0430\u043b\u0438 \u043c\u0435\u043d\u0435\u0435 \u043f\u0440\u0435\u0434\u0441\u043a\u0430\u0437\u0443\u0435\u043c\u044b \u0438\u043b\u0438 \u0432\u043e\u043e\u0431\u0449\u0435 \u043d\u0435\u043f\u0440\u0435\u0434\u0441\u043a\u0430\u0437\u0443\u0435\u043c\u044b \u0434\u043b\u044f \u043d\u0435\u0439\u0440\u043e\u0441\u0435\u0442\u0438, \u0440\u0435\u043a\u043e\u043c\u0435\u043d\u0434\u0443\u0435\u0442\u0441\u044f \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u0432 \u0441\u0438\u0434 \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u0430 \u0435\u0449\u0451 \u043e\u0434\u043d\u0443 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u0443\u044e, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u0431\u0443\u0434\u0435\u0442 \u0440\u0435\u0448\u0430\u0442\u044c:<\/p>\n<ol>\n<li>\u041a\u0430\u043a\u0438\u0435 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0435 \u0432\u044b\u0431\u0440\u0430\u0442\u044c \u0438\u0437 <b>x<\/b>, <b>y<\/b>, <b>z<\/b> \u0438 <b>w<\/b> \u0434\u043b\u044f \u0433\u0435\u043d\u0435\u0440\u0430\u0446\u0438\u0438 <b>o<\/b>.  <\/li>\n<li>\u041d\u0430 \u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0431\u0438\u0442 \u0441\u0434\u0432\u0438\u043d\u0443\u0442\u044c \u043a\u0430\u0436\u0434\u0443\u044e \u0438\u0437 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0445.  <\/li>\n<li>\u0412 \u043a\u0430\u043a\u043e\u043c \u043d\u0430\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u0438 \u0441\u0434\u0432\u0438\u0433\u0430\u0442\u044c \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0435 \u2014 \u0432\u043b\u0435\u0432\u043e \u0438\u043b\u0438 \u0432\u043f\u0440\u0430\u0432\u043e.<\/li>\n<\/ol>\n<p>  <\/p>\n<h1>\u0412\u0437\u043b\u043e\u043c \u0432\u0438\u0445\u0440\u044f \u041c\u0435\u0440\u0441\u0435\u043d\u043d\u0430<\/h1>\n<p>  \u0421\u0445\u043e\u0436\u0438\u0439 \u043f\u043e\u0434\u0445\u043e\u0434 \u0430\u0432\u0442\u043e\u0440 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043b \u0434\u043b\u044f \u0432\u0437\u043b\u043e\u043c\u0430 <a href=\"https:\/\/en.wikipedia.org\/wiki\/Mersenne_Twister\">Mersenne Twister<\/a> (MT, \u0432\u0438\u0445\u0440\u044c \u041c\u0435\u0440\u0441\u0435\u043d\u043d\u0430), \u043e\u0434\u043d\u043e\u0433\u043e \u0438\u0437 \u0441\u0430\u043c\u044b\u0445 \u043f\u043e\u043f\u0443\u043b\u044f\u0440\u043d\u044b\u0445 \u0433\u0435\u043d\u0435\u0440\u0430\u0442\u043e\u0440\u043e\u0432 \u043f\u0441\u0435\u0432\u0434\u043e\u0441\u043b\u0443\u0447\u0430\u0439\u043d\u044b\u0445 \u0447\u0438\u0441\u0435\u043b, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0441\u0447\u0438\u0442\u0430\u043b\u0441\u044f \u043e\u0442\u043d\u043e\u0441\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u043d\u0430\u0434\u0451\u0436\u043d\u044b\u043c. \u0412\u0438\u0445\u0440\u044c \u041c\u0435\u0440\u0441\u0435\u043d\u043d\u0430 \u043e\u0441\u043d\u043e\u0432\u044b\u0432\u0430\u043d \u043d\u0430 \u0441\u0432\u043e\u0439\u0441\u0442\u0432\u0430\u0445 \u043f\u0440\u043e\u0441\u0442\u044b\u0445 \u0447\u0438\u0441\u0435\u043b \u041c\u0435\u0440\u0441\u0435\u043d\u043d\u0430 (\u043e\u0442\u0441\u044e\u0434\u0430 \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u0435) \u0438 \u043e\u0431\u0435\u0441\u043f\u0435\u0447\u0438\u0432\u0430\u0435\u0442 \u0431\u044b\u0441\u0442\u0440\u0443\u044e \u0433\u0435\u043d\u0435\u0440\u0430\u0446\u0438\u044e \u0432\u044b\u0441\u043e\u043a\u043e\u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435\u043d\u043d\u044b\u0445 \u043f\u0441\u0435\u0432\u0434\u043e\u0441\u043b\u0443\u0447\u0430\u0439\u043d\u044b\u0445 \u0447\u0438\u0441\u0435\u043b. \u041e\u043d \u043b\u0438\u0448\u0451\u043d \u043c\u043d\u043e\u0433\u0438\u0445 \u043d\u0435\u0434\u043e\u0441\u0442\u0430\u0442\u043a\u043e\u0432, \u043f\u0440\u0438\u0441\u0443\u0449\u0438\u0445 \u0434\u0440\u0443\u0433\u0438\u043c \u0413\u041f\u0421\u0427, \u0442\u0430\u043a\u0438\u0445 \u043a\u0430\u043a \u043c\u0430\u043b\u044b\u0439 \u043f\u0435\u0440\u0438\u043e\u0434, \u043f\u0440\u0435\u0434\u0441\u043a\u0430\u0437\u0443\u0435\u043c\u043e\u0441\u0442\u044c, \u043b\u0435\u0433\u043a\u043e \u0432\u044b\u044f\u0432\u043b\u044f\u0435\u043c\u044b\u0435 \u0441\u0442\u0430\u0442\u0438\u0441\u0442\u0438\u0447\u0435\u0441\u043a\u0438\u0435 \u0437\u0430\u043a\u043e\u043d\u043e\u043c\u0435\u0440\u043d\u043e\u0441\u0442\u0438.<\/p>\n<p>  \u0422\u0435\u043c \u043d\u0435 \u043c\u0435\u043d\u0435\u0435, \u044d\u0442\u043e\u0442 \u0433\u0435\u043d\u0435\u0440\u0430\u0442\u043e\u0440 \u043d\u0435 \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u043a\u0440\u0438\u043f\u0442\u043e\u0441\u0442\u043e\u0439\u043a\u0438\u043c, \u0447\u0442\u043e \u0438 \u0434\u043e\u043a\u0430\u0437\u0430\u043b \u0432\u043e <a href=\"https:\/\/research.nccgroup.com\/2021\/10\/18\/cracking-random-number-generators-using-machine-learning-part-2-mersenne-twister\/#%5B1%5D\">\u0432\u0442\u043e\u0440\u043e\u0439 \u0447\u0430\u0441\u0442\u0438 \u0441\u0432\u043e\u0435\u0433\u043e \u0438\u0441\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u043d\u0438\u044f<\/a> \u041c\u043e\u0441\u0442\u0430\u0444\u0430 \u0425\u0430\u0441\u0441\u0430\u043d.<\/p>\n<p>  \u0415\u0441\u0442\u044c \u043c\u043d\u043e\u0433\u043e \u0432\u0430\u0440\u0438\u0430\u043d\u0442\u043e\u0432 MT, \u0441\u0430\u043c\u044b\u0439 \u043f\u043e\u043f\u0443\u043b\u044f\u0440\u043d\u044b\u0439 MT19937, \u043f\u0435\u0440\u0438\u043e\u0434 \u043a\u043e\u0442\u043e\u0440\u043e\u0433\u043e \u0441\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 2<sup>19937<\/sup>? 1 (\u043f\u0440\u0438\u0431\u043b\u0438\u0437\u0438\u0442\u0435\u043b\u044c\u043d\u043e 4,3&#215;10<sup>6001<\/sup>).<\/p>\n<p>  MT \u043c\u043e\u0436\u043d\u043e \u0440\u0430\u0441\u0441\u043c\u0430\u0442\u0440\u0438\u0432\u0430\u0442\u044c \u043a\u0430\u043a \u043d\u0435\u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u0443\u044e \u0444\u043e\u0440\u043c\u0443 <a href=\"https:\/\/ru.wikipedia.org\/wiki\/%D0%A0%D0%B5%D0%B3%D0%B8%D1%81%D1%82%D1%80_%D1%81%D0%B4%D0%B2%D0%B8%D0%B3%D0%B0_%D1%81_%D0%BB%D0%B8%D0%BD%D0%B5%D0%B9%D0%BD%D0%BE%D0%B9_%D0%BE%D0%B1%D1%80%D0%B0%D1%82%D0%BD%D0%BE%D0%B9_%D1%81%D0%B2%D1%8F%D0%B7%D1%8C%D1%8E\">\u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0430 \u0441\u0434\u0432\u0438\u0433\u0430 \u0441 \u043b\u0438\u043d\u0435\u0439\u043d\u043e\u0439 \u043e\u0431\u0440\u0430\u0442\u043d\u043e\u0439 \u0441\u0432\u044f\u0437\u044c\u044e<\/a> (LFSR). \u0418\u0434\u0435\u044f LFSR \u0437\u0430\u043a\u043b\u044e\u0447\u0430\u0435\u0442\u0441\u044f \u0432 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0438 \u043b\u0438\u043d\u0435\u0439\u043d\u043e\u0439 \u0431\u0443\u043b\u0435\u0432\u043e\u0439 \u0444\u0443\u043d\u043a\u0446\u0438\u0438, \u0442\u0430\u043a\u043e\u0439 \u043a\u0430\u043a XOR, \u0441\u043e \u0441\u0442\u0430\u0440\u044b\u043c \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435\u043c \u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0430 \u0434\u043b\u044f \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u044f \u043d\u043e\u0432\u043e\u0433\u043e \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0430. \u0412 \u041c\u0422 \u0432\u043d\u0443\u0442\u0440\u0435\u043d\u043d\u0435\u0435 \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0435 \u0441\u043e\u0445\u0440\u0430\u043d\u044f\u0435\u0442\u0441\u044f \u0432 \u0432\u0438\u0434\u0435 \u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0438 32-\u0431\u0438\u0442\u043d\u044b\u0445 \u0441\u043b\u043e\u0432. \u0420\u0430\u0437\u043c\u0435\u0440 \u0432\u043d\u0443\u0442\u0440\u0435\u043d\u043d\u0435\u0433\u043e \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u044f \u0437\u0430\u0432\u0438\u0441\u0438\u0442 \u043e\u0442 \u0432\u0430\u0440\u0438\u0430\u043d\u0442\u0430 \u041c\u0422, \u0432 \u0441\u043b\u0443\u0447\u0430\u0435 MT19937 \u043e\u043d \u0440\u0430\u0432\u0435\u043d 624. \u041f\u0441\u0435\u0432\u0434\u043e\u043a\u043e\u0434 \u041c\u0422 \u043f\u0440\u0438\u0432\u0435\u0434\u0451\u043d \u043d\u0438\u0436\u0435, \u0438\u0437 \u0412\u0438\u043a\u0438\u043f\u0435\u0434\u0438\u0438:<\/p>\n<pre><code class=\"python\"> \/\/ Create a length n array to store the state of the generator  int[0..n-1] MT  int index := n+1  const int lower_mask = (1 &lt;&lt; r) - 1 \/\/ That is, the binary number of r 1's  const int upper_mask = lowest w bits of (not lower_mask)    \/\/ Initialize the generator from a seed  function seed_mt(int seed) {      index := n      MT[0] := seed      for i from 1 to (n - 1) { \/\/ loop over each element          MT[i] := lowest w bits of (f * (MT[i-1] xor (MT[i-1] >> (w-2))) + i)      }  }    \/\/ Extract a tempered value based on MT[index]  \/\/ calling twist() every n numbers  function extract_number() {      if index >= n {          if index > n {            error \"Generator was never seeded\"            \/\/ Alternatively, seed with constant value; 5489 is used in reference C code[53]          }          twist()      }        int y := MT[index]      y := y xor ((y >> u) and d)      y := y xor ((y &lt;&lt; s) and b)      y := y xor ((y &lt;&lt; t) and c)      y := y xor (y >> l)        index := index + 1      return lowest w bits of (y)  }    \/\/ Generate the next n values from the series x_i   function twist() {      for i from 0 to (n-1) {          int x := (MT[i] and upper_mask)                    + (MT[(i+1) mod n] and lower_mask)          int xA := x >> 1          if (x mod 2) != 0 { \/\/ lowest bit of x is 1              xA := xA xor a          }          MT[i] := MT[(i + m) mod n] xor xA      }      index := 0  } <\/code><\/pre>\n<p>  \u041e\u0431\u0440\u0430\u0442\u0438\u0442\u0435 \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u0435, \u0447\u0442\u043e \u0432 \u043a\u043e\u0434\u0435 13 \u043a\u043e\u043d\u0441\u0442\u0430\u043d\u0442 w, n, m, r, a, u, d, s, b, t, c, l, f\u00a0\u2014 \u043e\u043d\u0438 \u043c\u043e\u0433\u0443\u0442 \u0438\u0437\u043c\u0435\u043d\u044f\u0442\u044c\u0441\u044f \u0432 \u0440\u0430\u0437\u043d\u044b\u0445 \u0432\u0435\u0440\u0441\u0438\u044f\u0445 \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u0430.<\/p>\n<p>  \u0418\u0437 \u043f\u0441\u0435\u0432\u0434\u043e\u043a\u043e\u0434\u0430 \u0442\u0430\u043a\u0436\u0435 \u0432\u0438\u0434\u043d\u043e, \u0447\u0442\u043e \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c \u0440\u0430\u0437\u0431\u0438\u0432\u0430\u0435\u0442\u0441\u044f \u043d\u0430 \u0434\u0432\u0430 \u043e\u0441\u043d\u043e\u0432\u043d\u044b\u0445 \u0448\u0430\u0433\u0430: 1)\u00a0\u0441\u043c\u0435\u043d\u0430 \u0447\u0438\u0441\u043b\u0430; 2)\u00a0\u0442\u0440\u0430\u043d\u0441\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044f \u0447\u0438\u0441\u043b\u0430, \u0447\u0442\u043e\u0431\u044b \u043f\u0440\u0435\u0432\u0440\u0430\u0442\u0438\u0442\u044c \u0435\u0433\u043e \u0432 \u00ab\u0441\u043b\u0443\u0447\u0430\u0439\u043d\u043e\u0435\u00bb. \u041f\u0435\u0440\u0432\u044b\u0439 \u0448\u0430\u0433 \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u0442\u0441\u044f 1 \u0440\u0430\u0437 \u043a\u0430\u0436\u0434\u044b\u0435 624 \u0432\u044b\u0437\u043e\u0432\u0430 (\u0432 MT19937), \u0442\u043e \u0435\u0441\u0442\u044c \u0438\u0441\u0445\u043e\u0434\u043d\u043e\u0435 \u0447\u0438\u0441\u043b\u043e \u043f\u0435\u0440\u0438\u043e\u0434\u0438\u0447\u0435\u0441\u043a\u0438 \u043c\u0435\u043d\u044f\u0435\u0442\u0441\u044f. \u0412\u0442\u043e\u0440\u043e\u0439 \u0448\u0430\u0433 \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u0442\u0441\u044f 624 \u0440\u0430\u0437\u0430, \u0442\u043e \u0435\u0441\u0442\u044c \u0438\u0437 \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u0438\u0441\u0445\u043e\u0434\u043d\u043e\u0433\u043e \u0447\u0438\u0441\u043b\u0430 \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u0442\u0441\u044f 624 \u00ab\u0441\u043b\u0443\u0447\u0430\u0439\u043d\u044b\u0445\u00bb \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u0430.<\/p>\n<p>  \u0412 \u0434\u0430\u043d\u043d\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u0430\u0432\u0442\u043e\u0440\u0443 \u043f\u0440\u0438\u0448\u043b\u043e\u0441\u044c \u043e\u0431\u0443\u0447\u0430\u0442\u044c \u0434\u0432\u0435 \u043c\u043e\u0434\u0435\u043b\u0438 ML \u0434\u043b\u044f \u0434\u0432\u0443\u0445 \u044d\u0442\u0430\u043f\u043e\u0432 \u0440\u0430\u0431\u043e\u0442\u044b \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u0430. \u0417\u0430\u0442\u0435\u043c \u043e\u043d \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043b \u0438\u0445 \u0432\u043c\u0435\u0441\u0442\u0435, \u0447\u0442\u043e\u0431\u044b \u0440\u0430\u0441\u043f\u043e\u0437\u043d\u0430\u0442\u044c \u0438\u0441\u0445\u043e\u0434\u043d\u043e\u0435 \u0447\u0438\u0441\u043b\u043e \u043f\u043e \u0435\u0433\u043e \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u0443 (\u0440\u0435\u0432\u0435\u0440\u0441).<\/p>\n<h3>\u041f\u0435\u0440\u0432\u0430\u044f \u043c\u043e\u0434\u0435\u043b\u044c<\/h3>\n<p>  \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0434\u043b\u044f \u043f\u0435\u0440\u0432\u043e\u0433\u043e \u044d\u0442\u0430\u043f\u0430 \u0432 \u0432\u044b\u0448\u0435\u043f\u0440\u0438\u0432\u0435\u0434\u0451\u043d\u043d\u043e\u043c \u043a\u043e\u0434\u0435 \u0434\u0435\u0439\u0441\u0442\u0432\u0443\u0435\u0442 \u0442\u0430\u043a\u0430\u044f \u0441\u0445\u0435\u043c\u0430:<\/p>\n<p>  <code>MT[i] = f(MT[i - 624], MT[i - 624 + 1], MT[i - 624 + m])<\/p>\n<p>  = f(MT[i - 624], MT[i - 623], MT[i - 227]) (\u043f\u0440\u0438 m = 397, \u043a\u0430\u043a \u0432 MT19937)<\/code> <\/p>\n<p>  \u041a\u0430\u0436\u0434\u043e\u0435 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0435 \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0435 \u0447\u0438\u0441\u043b\u0430 \u0437\u0430\u0432\u0438\u0441\u0438\u0442 \u043e\u0442 \u0442\u0440\u0451\u0445 \u043f\u0440\u0435\u0434\u044b\u0434\u0443\u0449\u0438\u0445 \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0439. \u0415\u0441\u043b\u0438 \u043a\u043e\u043d\u043a\u0440\u0435\u0442\u043d\u043e, \u0434\u043b\u044f \u0433\u0435\u043d\u0435\u0440\u0430\u0446\u0438\u0438 \u043d\u043e\u0432\u043e\u0433\u043e \u0447\u0438\u0441\u043b\u0430 \u0438\u0437 \u0442\u0440\u0451\u0445 \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u044e\u0449\u0438\u0445 \u043c\u043e\u0436\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0442\u0430\u043a\u043e\u0439 \u043a\u043e\u0434 C++, \u043e\u043d \u0432\u044b\u0434\u0430\u0451\u0442 \u0442\u043e\u0442 \u0436\u0435 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442, \u0447\u0442\u043e \u0432 \u0440\u0435\u0430\u043b\u044c\u043d\u044b\u0445 \u0413\u041f\u0421\u0427, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e\u0442\u0441\u044f \u043d\u0430 \u043f\u0440\u0430\u043a\u0442\u0438\u043a\u0435:<\/p>\n<pre><code class=\"cpp\">uint inp_out_xor_bitsY[32] = {     0xfe87caa8,     0x400091,     0x84092000,     0x1000044,     0x2040489,     0x6000990,     0x8001220,     0xeea7cea0,     0x20004880,     0x4080002,     0x80002200,     0xff95eeac,     0x2000880,     0x8081202,     0x10102404,     0x204008,     0x44089102,     0x84892122,     0xff85cae8,     0x2440010,     0x84012002,     0x1100040,     0xecb3ea6d,     0x6400980,     0xc881302,     0x6fa7eee0,     0x22004800,     0x80102,     0x88002000,     0xef95eaac,     0x22000080,     0xc001300 };  uint gen_new_number(uint MT_624, uint MT_623, uint MT_227) {     uint r = 0;     uint i = 0;     do {         r ^= (MT_623 &amp; 1) * inp_out_xor_bitsY[i++];     }     while (MT_623 >>= 1);          MT_624 &amp;= 0x89130204;     MT_624 ^= MT_624 >> 16;     MT_624 ^= MT_624 >> 8;     MT_624 ^= MT_624 >> 4;     MT_624 ^= MT_624 >> 2;     MT_624 ^= MT_624 >> 1;     r ^= (MT_624 &amp; 1) * 0x44081102;          r ^= MT_227;     return r; }<\/code><\/pre>\n<p>  <\/p>\n<h3>\u0412\u0442\u043e\u0440\u0430\u044f \u043c\u043e\u0434\u0435\u043b\u044c<\/h3>\n<p>  \u0412\u0442\u043e\u0440\u0430\u044f \u043d\u0435\u0439\u0440\u043e\u0441\u0435\u0442\u044c \u0434\u043b\u044f \u0442\u0440\u0430\u043d\u0441\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u0438 \u043e\u043a\u0430\u0437\u0430\u043b\u0430\u0441\u044c \u0433\u043e\u0440\u0430\u0437\u0434\u043e \u0441\u043b\u043e\u0436\u043d\u0435\u0435: 672 \u043d\u0435\u0439\u0440\u043e\u043d\u0430 \u0432\u043c\u0435\u0441\u0442\u043e 128, 41\u00a0632 \u043e\u0431\u0443\u0447\u0430\u0435\u043c\u044b\u0445 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u0430 \u0432\u043c\u0435\u0441\u0442\u043e 9440. \u0412 \u043e\u0441\u0442\u0430\u043b\u044c\u043d\u043e\u043c \u0434\u0432\u0435 \u043c\u043e\u0434\u0435\u043b\u0438 \u043f\u043e\u0445\u043e\u0436\u0438: \u0442\u0438\u043f Dense (\u043f\u043b\u043e\u0442\u043d\u0430\u044f \u0441\u0432\u0451\u0440\u0442\u043e\u0447\u043d\u0430\u044f \u0441\u0435\u0442\u044c), \u0444\u0443\u043d\u043a\u0446\u0438\u044f \u043f\u043e\u0442\u0435\u0440\u044c <code>binary_crossentropy<\/code>, \u0441\u043a\u0440\u044b\u0442\u044b\u0439 \u0441\u043b\u043e\u0439 <code>relu<\/code>, \u0432\u043d\u0435\u0448\u043d\u0438\u0439 \u0441\u043b\u043e\u0439 <code>sigmoid<\/code>.<\/p>\n<p>  \u041f\u043e\u0441\u043b\u0435 \u043e\u0431\u0443\u0447\u0435\u043d\u0438\u044f \u043c\u043e\u0434\u0435\u043b\u044c \u043f\u043e\u043a\u0430\u0437\u0430\u043b\u0430 \u0431\u0438\u0442\u043e\u0432\u0443\u044e \u0442\u043e\u0447\u043d\u043e\u0441\u0442\u044c 100% \u043a\u0430\u043a \u043d\u0430 \u043d\u0430\u0431\u043e\u0440\u0435 \u0442\u0440\u0435\u043d\u0438\u0440\u043e\u0432\u043e\u0447\u043d\u044b\u0445 \u0434\u0430\u043d\u043d\u044b\u0445, \u0442\u0430\u043a \u0438 \u043d\u0430 \u0442\u0435\u0441\u0442\u043e\u0432\u043e\u043c \u043d\u0430\u0431\u043e\u0440\u0435. \u0414\u043b\u044f \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0438 \u043d\u0430 \u0441\u0442\u043e\u0440\u043e\u043d\u043d\u0435\u043c \u0413\u041f\u0421\u0427 \u0431\u044b\u043b\u043e \u0434\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u0441\u0433\u0435\u043d\u0435\u0440\u0438\u0440\u043e\u0432\u0430\u043d\u043e 100\u00a0000 \u0441\u043b\u0443\u0447\u0430\u0439\u043d\u044b\u0445 \u0447\u0438\u0441\u0435\u043b \u0441 \u043d\u043e\u0432\u044b\u043c\u0438 \u0441\u0438\u0434\u0430\u043c\u0438\u00a0\u2014 \u0438 \u0442\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u043d\u0430 \u044d\u0442\u043e\u043c \u043f\u043e\u043b\u043d\u043e\u0441\u0442\u044c\u044e \u043d\u043e\u0432\u043e\u043c \u043d\u0430\u0431\u043e\u0440\u0435 \u0434\u0430\u043d\u043d\u044b\u0445 \u0442\u043e\u0436\u0435 \u043f\u043e\u043a\u0430\u0437\u0430\u043b\u043e \u0442\u043e\u0447\u043d\u043e\u0441\u0442\u044c 100%.<\/p>\n<p>  \u0422\u043e \u0435\u0441\u0442\u044c \u043c\u043e\u0434\u0435\u043b\u044c \u0441\u043f\u043e\u0441\u043e\u0431\u043d\u0430 \u043f\u043e \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u0443 MT19937 \u0442\u043e\u0447\u043d\u043e \u0440\u0430\u0441\u043f\u043e\u0437\u043d\u0430\u0442\u044c \u0441\u0438\u0434, \u0430 \u0443\u0436\u0435 \u0438\u0437 \u043d\u0435\u0433\u043e \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u0432\u0441\u0435 624 \u00ab\u0441\u043b\u0443\u0447\u0430\u0439\u043d\u044b\u0445\u00bb \u0447\u0438\u0441\u043b\u0430.<\/p>\n<p>  \u0418\u0441\u0445\u043e\u0434\u043d\u044b\u0439 \u043a\u043e\u0434 \u0432 <a href=\"https:\/\/github.com\/nccgroup\/ML-for-RNGs\/tree\/main\/rng_mt\">\u0440\u0435\u043f\u043e\u0437\u0438\u0442\u043e\u0440\u0438\u0438<\/a>.<\/p>\n<hr\/>\n<p>  \u0412\u044b\u0432\u043e\u0434 \u0438\u0437 \u044d\u0442\u043e\u0433\u043e \u0442\u0430\u043a\u043e\u0439: \u0445\u043e\u0442\u044f \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442 \u0413\u041f\u0421\u0427 \u043a\u0430\u0436\u0435\u0442\u0441\u044f \u0441\u043b\u0443\u0447\u0430\u0439\u043d\u044b\u043c \u0434\u043b\u044f \u0447\u0435\u043b\u043e\u0432\u0435\u043a\u0430 (\u0441\u043c. \u041a\u0414\u041f\u0412), \u043e\u0431\u0443\u0447\u0435\u043d\u043d\u0430\u044f \u043d\u0435\u0439\u0440\u043e\u0441\u0435\u0442\u044c \u043c\u043e\u0436\u0435\u0442 \u043d\u0430\u0439\u0442\u0438 \u0432\u0437\u0430\u0438\u043c\u043e\u0441\u0432\u044f\u0437\u044c \u043c\u0435\u0436\u0434\u0443 \u0432\u0445\u043e\u0434\u044f\u0449\u0438\u043c\u0438 \u0438 \u0438\u0441\u0445\u043e\u0434\u044f\u0449\u0438\u043c\u0438 \u0447\u0438\u0441\u043b\u0430\u043c\u0438\u00a0\u2014 \u0438 \u043f\u0440\u0435\u0434\u0441\u043a\u0430\u0437\u0430\u0442\u044c \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442.<\/p>\n<p>  \u041d\u0443\u0436\u043d\u043e \u0437\u0430\u043c\u0435\u0442\u0438\u0442\u044c, \u0447\u0442\u043e \u043d\u0435\u0431\u0435\u0437\u043e\u043f\u0430\u0441\u043d\u044b\u0435 \u0413\u041f\u0421\u0427 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e\u0442\u0441\u044f \u043a\u0430\u043a \u0447\u0430\u0441\u0442\u044c \u0440\u0435\u0430\u043b\u044c\u043d\u044b\u0445 \u043a\u0440\u0438\u043f\u0442\u043e\u0433\u0440\u0430\u0444\u0438\u0447\u0435\u0441\u043a\u0438 \u0431\u0435\u0437\u043e\u043f\u0430\u0441\u043d\u044b\u0445 \u0413\u041f\u0421\u0427. \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, <a href=\"https:\/\/eprint.iacr.org\/2005\/165.pdf\">\u0432\u0438\u0445\u0440\u044c \u041c\u0435\u0440\u0441\u0435\u043d\u043d\u0430 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u0432 \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u0435 CryptMT<\/a>.<\/p>\n<hr\/>\n<p>  <a href=\"http:\/\/miran.ru\/\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w780q1\/webt\/8p\/hx\/-1\/8phx-1apbwvk5vchi3wxibeaorw.jpeg\" data-src=\"https:\/\/habrastorage.org\/webt\/8p\/hx\/-1\/8phx-1apbwvk5vchi3wxibeaorw.jpeg\" data-blurred=\"true\"\/><\/a><\/div>\n<\/div>\n<\/div>\n<p><!----><!----><\/div>\n<p><!----><!----><br \/> \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"https:\/\/habr.com\/ru\/articles\/584692\/\"> https:\/\/habr.com\/ru\/articles\/584692\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<div><!--[--><!--]--><\/div>\n<div id=\"post-content-body\">\n<div>\n<div class=\"article-formatted-body article-formatted-body article-formatted-body_version-1\">\n<div xmlns=\"http:\/\/www.w3.org\/1999\/xhtml\">\n<div style=\"text-align:center;\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w780q1\/webt\/cp\/w8\/z-\/cpw8z-ucbhbebw0micqndtz4wee.jpeg\" data-src=\"https:\/\/habrastorage.org\/webt\/cp\/w8\/z-\/cpw8z-ucbhbebw0micqndtz4wee.jpeg\" data-blurred=\"true\"\/><\/div>\n<p>  <i>\u0412\u044b\u0434\u0430\u0447\u0430 XORShift \u043a\u0430\u0436\u0435\u0442\u0441\u044f \u0441\u043b\u0443\u0447\u0430\u0439\u043d\u043e\u0439<\/i> <\/p>\n<p>  \u0418\u0441\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c \u041c\u043e\u0441\u0442\u0430\u0444\u0430 \u0425\u0430\u0441\u0441\u0430\u043d (Mostafa Hassan) <a href=\"https:\/\/research.nccgroup.com\/2021\/10\/15\/cracking-random-number-generators-using-machine-learning-part-1-xorshift128\/\">\u0441\u0443\u043c\u0435\u043b \u0432\u0437\u043b\u043e\u043c\u0430\u0442\u044c<\/a> \u0434\u0432\u0430 \u0433\u0435\u043d\u0435\u0440\u0430\u0442\u043e\u0440\u0430 \u043f\u0441\u0432\u0435\u0434\u043e\u0441\u043b\u0443\u0447\u0430\u0439\u043d\u044b\u0445 \u0447\u0438\u0441\u0435\u043b (\u0413\u041f\u0421\u0427) \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u043c\u0430\u0448\u0438\u043d\u043d\u043e\u0433\u043e \u043e\u0431\u0443\u0447\u0435\u043d\u0438\u044f. \u041e\u0431\u0443\u0447\u0435\u043d\u043d\u0430\u044f \u0434\u0432\u0443\u0441\u043b\u043e\u0439\u043d\u0430\u044f \u043d\u0435\u0439\u0440\u043e\u0441\u0435\u0442\u044c \u043f\u0440\u0435\u0434\u0441\u043a\u0430\u0437\u0430\u043b\u0430 \u0432\u044b\u0434\u0430\u0447\u0443 \u0433\u0435\u043d\u0435\u0440\u0430\u0442\u043e\u0440\u0430 xorshift128 \u0441 \u0442\u043e\u0447\u043d\u043e\u0441\u0442\u044c\u044e 100%.<\/p>\n<p>  \u0412\u043e <a href=\"https:\/\/research.nccgroup.com\/2021\/10\/18\/cracking-random-number-generators-using-machine-learning-part-2-mersenne-twister\/\">\u0432\u0442\u043e\u0440\u043e\u0439 \u0447\u0430\u0441\u0442\u0438<\/a> \u0441\u0432\u043e\u0435\u0439 \u0440\u0430\u0431\u043e\u0442\u044b \u041c\u043e\u0441\u0442\u0430\u0444\u0430 \u043e\u043f\u0438\u0441\u0430\u043b \u0435\u0449\u0451 \u043e\u0434\u043d\u0443 \u043d\u0435\u0439\u0440\u043e\u0441\u0435\u0442\u044c, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u0432\u0437\u043b\u043e\u043c\u0430\u043b\u0430 \u043f\u043e\u043f\u0443\u043b\u044f\u0440\u043d\u044b\u0439 \u0433\u0435\u043d\u0435\u0440\u0430\u0442\u043e\u0440 Mersenne Twister (\u0432\u0438\u0445\u0440\u044c \u041c\u0435\u0440\u0441\u0435\u043d\u043d\u0430, MT, MT19937) \u0442\u043e\u0436\u0435 \u0441 \u0442\u043e\u0447\u043d\u043e\u0441\u0442\u044c\u044e 100%.  <\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[],"tags":[],"class_list":["post-381205","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/381205","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=381205"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/381205\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=381205"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=381205"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=381205"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}