{"id":262756,"date":"2015-08-02T20:31:02","date_gmt":"2015-08-02T16:31:02","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=262756"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=262756","title":{"rendered":"\u0413\u0435\u043d\u0435\u0440\u0430\u0442\u043e\u0440\u044b \u043d\u0435\u043f\u0440\u0435\u0440\u044b\u0432\u043d\u043e \u0440\u0430\u0441\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u043d\u044b\u0445 \u0441\u043b\u0443\u0447\u0430\u0439\u043d\u044b\u0445 \u0432\u0435\u043b\u0438\u0447\u0438\u043d"},"content":{"rendered":"<br \/>\n<blockquote><p>\u0413\u0435\u043d\u0435\u0440\u0430\u0442\u043e\u0440 \u0441\u043b\u0443\u0447\u0430\u0439\u043d\u044b\u0445 \u0447\u0438\u0441\u0435\u043b \u0432\u043e \u043c\u043d\u043e\u0433\u043e\u043c \u043f\u043e\u0434\u043e\u0431\u0435\u043d \u0441\u0435\u043a\u0441\u0443: \u043a\u043e\u0433\u0434\u0430 \u043e\u043d \u0445\u043e\u0440\u043e\u0448 \u2014 \u044d\u0442\u043e \u043f\u0440\u0435\u043a\u0440\u0430\u0441\u043d\u043e, \u043a\u043e\u0433\u0434\u0430 \u043e\u043d \u043f\u043b\u043e\u0445, \u0432\u0441\u0435 \u0440\u0430\u0432\u043d\u043e \u043f\u0440\u0438\u044f\u0442\u043d\u043e (\u0414\u0436\u043e\u0440\u0434\u0436 \u041c\u0430\u0440\u0441\u0430\u043b\u044c\u044f, 1984)<\/p><\/blockquote>\n<p>  \u041f\u043e\u043f\u0443\u043b\u044f\u0440\u043d\u043e\u0441\u0442\u044c \u0441\u0442\u043e\u0445\u0430\u0441\u0442\u0438\u0447\u0435\u0441\u043a\u0438\u0445 \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u043e\u0432 \u0432\u0441\u0435 \u0440\u0430\u0441\u0442\u0435\u0442. \u041c\u043d\u043e\u0433\u0438\u0435 \u0438\u0437 \u043d\u0438\u0445 \u0431\u0430\u0437\u0438\u0440\u0443\u044e\u0442\u0441\u044f \u043d\u0430 \u0433\u0435\u043d\u0435\u0440\u0430\u0446\u0438\u0438 \u0431\u043e\u043b\u044c\u0448\u043e\u0433\u043e \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u0430 \u0440\u0430\u0437\u043b\u0438\u0447\u043d\u044b\u0445 \u0441\u043b\u0443\u0447\u0430\u0439\u043d\u044b\u0445 \u0432\u0435\u043b\u0438\u0447\u0438\u043d. \u0414\u0430\u043b\u0435\u043a\u043e \u043d\u0435 \u0432\u0441\u0435\u0433\u0434\u0430 \u0440\u0430\u0432\u043d\u043e\u043c\u0435\u0440\u043d\u043e \u0440\u0430\u0441\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u043d\u044b\u0445. \u0417\u0434\u0435\u0441\u044c \u044f \u043f\u043e\u043f\u044b\u0442\u0430\u043b\u0441\u044f \u0441\u043e\u0431\u0440\u0430\u0442\u044c \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044e \u043e \u0431\u044b\u0441\u0442\u0440\u044b\u0445 \u0438 \u0442\u043e\u0447\u043d\u044b\u0445 \u0433\u0435\u043d\u0435\u0440\u0430\u0442\u043e\u0440\u0430\u0445 \u0441\u043b\u0443\u0447\u0430\u0439\u043d\u044b\u0445 \u0432\u0435\u043b\u0438\u0447\u0438\u043d \u0441 \u0438\u0437\u0432\u0435\u0441\u0442\u043d\u044b\u043c\u0438 \u0440\u0430\u0441\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u044f\u043c\u0438. \u0417\u0430\u0434\u0430\u0447\u0438 \u043c\u043e\u0433\u0443\u0442 \u0431\u044b\u0442\u044c \u0440\u0430\u0437\u043d\u044b\u043c\u0438, \u0440\u0430\u0437\u043d\u044b\u043c\u0438 \u043c\u043e\u0433\u0443\u0442 \u0431\u044b\u0442\u044c \u0438 \u043a\u0440\u0438\u0442\u0435\u0440\u0438\u0438. \u041a\u043e\u043c\u0443-\u0442\u043e \u0432\u0430\u0436\u043d\u043e \u0432\u0440\u0435\u043c\u044f \u0433\u0435\u043d\u0435\u0440\u0430\u0446\u0438\u0438, \u043a\u043e\u043c\u0443-\u0442\u043e \u2014 \u0442\u043e\u0447\u043d\u043e\u0441\u0442\u044c, \u043a\u043e\u043c\u0443-\u0442\u043e \u2014 \u043a\u0440\u0438\u043f\u0442\u043e\u0443\u0441\u0442\u043e\u0439\u0447\u0438\u0432\u043e\u0441\u0442\u044c, \u043a\u043e\u043c\u0443-\u0442\u043e \u2014 \u0441\u043a\u043e\u0440\u043e\u0441\u0442\u044c \u0441\u0445\u043e\u0434\u0438\u043c\u043e\u0441\u0442\u0438. \u041b\u0438\u0447\u043d\u043e \u044f \u0438\u0441\u0445\u043e\u0434\u0438\u043b \u0438\u0437 \u043f\u0440\u0435\u0434\u043f\u043e\u043b\u043e\u0436\u0435\u043d\u0438\u044f, \u0447\u0442\u043e \u043c\u044b \u0438\u043c\u0435\u0435\u043c \u043d\u0435\u043a\u0438\u0439 \u0431\u0430\u0437\u043e\u0432\u044b\u0439 \u0433\u0435\u043d\u0435\u0440\u0430\u0442\u043e\u0440, \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u044e\u0449\u0438\u0439 \u043f\u0441\u0435\u0432\u0434\u043e\u0441\u043b\u0443\u0447\u0430\u0439\u043d\u043e\u0435 \u0446\u0435\u043b\u043e\u0435 \u0447\u0438\u0441\u043b\u043e, \u0440\u0430\u0432\u043d\u043e\u043c\u0435\u0440\u043d\u043e \u0440\u0430\u0441\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u043d\u043e\u0435 \u043e\u0442 0 \u0434\u043e \u043d\u0435\u043a\u043e\u0433\u043e RAND_MAX<\/p>\n<pre><code>unsigned long BasicRandGenerator() {     unsigned long randomVariable;     \/\/ some magic here     ...     return randomVariable; } <\/code><\/pre>\n<p>  \u0438 \u0447\u0442\u043e \u044d\u0442\u043e\u0442 \u0433\u0435\u043d\u0435\u0440\u0430\u0442\u043e\u0440 \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u0431\u044b\u0441\u0442\u0440\u044b\u0439. \u042f \u0438\u043c\u0435\u044e \u0432\u0432\u0438\u0434\u0443, \u0447\u0442\u043e \u0434\u0435\u0448\u0435\u0432\u043b\u0435 \u0441\u0433\u0435\u043d\u0435\u0440\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0441 \u0434\u0435\u0441\u044f\u0442\u043e\u043a \u0441\u043b\u0443\u0447\u0430\u0439\u043d\u044b\u0445 \u0447\u0438\u0441\u0435\u043b, \u043d\u0435\u0436\u0435\u043b\u0438 \u0447\u0435\u043c \u043f\u043e\u0441\u0447\u0438\u0442\u0430\u0442\u044c \u043b\u043e\u0433\u0430\u0440\u0438\u0444\u043c \u0438\u043b\u0438 \u0432\u043e\u0437\u0432\u0435\u0441\u0442\u0438 \u0432 \u0441\u0442\u0435\u043f\u0435\u043d\u044c \u043e\u0434\u043d\u043e \u0438\u0437 \u043d\u0438\u0445. \u042d\u0442\u043e \u043c\u043e\u0433\u0443\u0442 \u0431\u044b\u0442\u044c \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u044b\u0435 \u0433\u0435\u043d\u0435\u0440\u0430\u0442\u043e\u0440\u044b: std::rand(), rand \u0432 MATLAB, Java.util.Random \u0438 \u0442.\u0434. \u041d\u043e \u0438\u043c\u0435\u0439\u0442\u0435 \u0432\u0432\u0438\u0434\u0443, \u0447\u0442\u043e \u043f\u043e\u0434\u043e\u0431\u043d\u044b\u0435 \u0433\u0435\u043d\u0435\u0440\u0430\u0442\u043e\u0440\u044b \u0440\u0435\u0434\u043a\u043e \u043f\u043e\u0434\u0445\u043e\u0434\u044f\u0442 \u0434\u043b\u044f \u0441\u0435\u0440\u044c\u0435\u0437\u043d\u043e\u0439 \u0440\u0430\u0431\u043e\u0442\u044b. \u0417\u0430\u0447\u0430\u0441\u0442\u0443\u044e \u043e\u043d\u0438 \u043f\u0440\u043e\u0432\u0430\u043b\u0438\u0432\u0430\u044e\u0442 \u0440\u0430\u0437\u043d\u044b\u0435 \u0441\u0442\u0430\u0442\u0438\u0441\u0442\u0438\u0447\u0435\u0441\u043a\u0438\u0435 \u0442\u0435\u0441\u0442\u044b. \u0410 \u0442\u0430\u043a\u0436\u0435, \u043f\u043e\u043c\u043d\u0438\u0442\u0435, \u0447\u0442\u043e \u0432\u044b \u043f\u043e\u043b\u043d\u043e\u0441\u0442\u044c\u044e \u0437\u0430\u0432\u0438\u0441\u0438\u0442\u0435 \u043e\u0442 \u043d\u0438\u0445 \u0438 \u043b\u0443\u0447\u0448\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0441\u0432\u043e\u0439 \u0441\u043e\u0431\u0441\u0442\u0432\u0435\u043d\u043d\u044b\u0439 \u0433\u0435\u043d\u0435\u0440\u0430\u0442\u043e\u0440, \u0447\u0442\u043e\u0431\u044b \u0438\u043c\u0435\u0442\u044c \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u043e \u0435\u0433\u043e \u0440\u0430\u0431\u043e\u0442\u0435.<\/p>\n<p>  \u0412 \u0441\u0442\u0430\u0442\u044c\u0435 \u044f \u0431\u0443\u0434\u0443 \u0440\u0430\u0441\u0441\u043a\u0430\u0437\u044b\u0432\u0430\u0442\u044c \u043e\u0431 \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u0430\u0445, \u0441\u0443\u0442\u044c \u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u0434\u043e\u043b\u0436\u043d\u0430 \u0431\u044b\u0442\u044c \u043f\u043e\u043d\u044f\u0442\u043d\u0430 \u043a\u0430\u0436\u0434\u043e\u043c\u0443, \u043a\u0442\u043e \u0445\u043e\u0442\u044c \u0438\u043d\u043e\u0433\u0434\u0430 \u0441\u0442\u0430\u043b\u043a\u0438\u0432\u0430\u043b\u0441\u044f \u0441 \u0442\u0435\u043e\u0440\u0438\u0435\u0439 \u0432\u0435\u0440\u043e\u044f\u0442\u043d\u043e\u0441\u0442\u0435\u0439. \u0421\u043e\u0432\u0441\u0435\u043c \u043d\u0435\u043e\u0431\u044f\u0437\u0430\u0442\u0435\u043b\u044c\u043d\u043e \u0431\u044b\u0442\u044c \u0437\u043d\u0430\u043a\u043e\u043c\u044b\u043c \u0441 \u0442\u0435\u043e\u0440\u0438\u0435\u0439 \u043c\u0435\u0440\u044b, \u043a\u0430\u043a \u043f\u0440\u0430\u0432\u0438\u043b\u043e, \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u043f\u0440\u0438\u043c\u0435\u0440\u043d\u043e \u043f\u043e\u043d\u0438\u043c\u0430\u0442\u044c, \u0447\u0442\u043e \u0438\u0437 \u0441\u0435\u0431\u044f \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u044f\u044e\u0442 \u0444\u0443\u043d\u043a\u0446\u0438\u044f \u0440\u0430\u0441\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u044f \u0438 \u0444\u0443\u043d\u043a\u0446\u0438\u044f \u043f\u043b\u043e\u0442\u043d\u043e\u0441\u0442\u0438 \u0440\u0430\u0441\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u044f:<\/p>\n<div style=\"text-align:center;\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/files\/591\/8a7\/1dc\/5918a71dcb1e4a6bb432c273bc65541d.png\" \/><\/div>\n<p>  \u041a\u0430\u0436\u0434\u044b\u0439 \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c \u044f \u0431\u0443\u0434\u0443 \u0441\u043e\u043f\u0440\u043e\u0432\u043e\u0436\u0434\u0430\u0442\u044c \u043a\u043e\u0434\u043e\u043c, \u043d\u0435\u0431\u043e\u043b\u044c\u0448\u0438\u043c \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e\u043c \u043c\u0430\u0442\u0435\u043c\u0430\u0442\u0438\u043a\u0438 \u0438 \u0433\u0438\u0441\u0442\u043e\u0433\u0440\u0430\u043c\u043c\u043e\u0439 \u0438\u0437 \u0434\u0435\u0441\u044f\u0442\u043a\u0430 \u043c\u0438\u043b\u043b\u0438\u043e\u043d\u043e\u0432 \u0441\u0433\u0435\u043d\u0435\u0440\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0445 \u0441\u043b\u0443\u0447\u0430\u0439\u043d\u044b\u0445 \u0432\u0435\u043b\u0438\u0447\u0438\u043d.<\/p>\n<h4>\u0420\u0430\u0432\u043d\u043e\u043c\u0435\u0440\u043d\u043e\u0435 \u0440\u0430\u0441\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u0435<\/h4>\n<p>  <\/p>\n<div style=\"text-align:center;\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/files\/abf\/358\/849\/abf35884902446349f8fd3516788f894.png\" \/><\/div>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/files\/ccb\/249\/991\/ccb24999157e4f0d9b268e4b6bb7374d.png\"\/><\/p>\n<p>  <a name=\"habracut\"><\/a><br \/>  \u0420\u0430\u0432\u043d\u043e\u043c\u0435\u0440\u043d\u043e\u0435 \u0440\u0430\u0441\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u0435 \u043c\u043e\u0436\u0435\u0442 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c\u0441\u044f \u043f\u0440\u0438 \u0433\u0435\u043d\u0435\u0440\u0430\u0446\u0438\u0438 \u043f\u043e\u0447\u0442\u0438 \u0447\u0442\u043e \u043b\u044e\u0431\u043e\u0439 \u0441\u043b\u0443\u0447\u0430\u0439\u043d\u043e\u0439 \u0432\u0435\u043b\u0438\u0447\u0438\u043d\u044b, \u0431\u043b\u0430\u0433\u043e \u0438\u043c\u0435\u0435\u0442\u0441\u044f \u043e\u0447\u0435\u043d\u044c \u043f\u0440\u043e\u0441\u0442\u043e\u0439 \u0438 \u0443\u043d\u0438\u0432\u0435\u0440\u0441\u0430\u043b\u044c\u043d\u044b\u0439 <b>\u043c\u0435\u0442\u043e\u0434 \u0438\u043d\u0432\u0435\u0440\u0441\u0438\u0438 (inverse transform sampling)<\/b>: \u0433\u0435\u043d\u0435\u0440\u0438\u0440\u0443\u0435\u043c \u0441\u043b\u0443\u0447\u0430\u0439\u043d\u0443\u044e \u0432\u0435\u043b\u0438\u0447\u0438\u043d\u0443 U, \u0440\u0430\u0432\u043d\u043e\u043c\u0435\u0440\u043d\u043e \u0440\u0430\u0441\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u043d\u0443\u044e \u043e\u0442 0 \u0434\u043e 1, \u0438 \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u043c \u043e\u0431\u0440\u0430\u0442\u043d\u0443\u044e \u0444\u0443\u043d\u043a\u0446\u0438\u044e \u0440\u0430\u0441\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u044f (\u043a\u0432\u0430\u043d\u0442\u0438\u043b\u044c) \u0441 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u043e\u043c U. \u0414\u0435\u0439\u0441\u0442\u0432\u0438\u0442\u0435\u043b\u044c\u043d\u043e:<\/p>\n<div style=\"text-align:center;\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/files\/db6\/c26\/038\/db6c260383fb4971b4b2455942989543.png\" \/><\/div>\n<p>  \u041f\u0440\u043e\u0431\u043b\u0435\u043c\u0430 \u0432 \u0442\u043e\u043c, \u0447\u0442\u043e \u043f\u043e\u0434\u0441\u0447\u0435\u0442 \u043e\u0431\u0440\u0430\u0442\u043d\u043e\u0439 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u0440\u0430\u0441\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u044f \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u0434\u043e\u043b\u0433\u0438\u043c, \u0435\u0441\u043b\u0438 \u0432\u043e\u043e\u0431\u0449\u0435 \u0430\u043d\u0430\u043b\u0438\u0442\u0438\u0447\u0435\u0441\u043a\u0438 \u0432\u043e\u0437\u043c\u043e\u0436\u0435\u043d. <\/p>\n<p>  \u0421 \u0433\u0435\u043d\u0435\u0440\u0430\u0442\u043e\u0440\u043e\u043c \u0440\u0430\u0432\u043d\u043e\u043c\u0435\u0440\u043d\u043e\u0433\u043e \u0440\u0430\u0441\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u044f, \u044f \u043d\u0430\u0434\u0435\u044e\u0441\u044c, \u043c\u043d\u0435 \u043d\u0435 \u043d\u0443\u0436\u043d\u043e \u0434\u043e\u043b\u0433\u043e \u043e\u0441\u0442\u0430\u043d\u0430\u0432\u043b\u0438\u0432\u0430\u0442\u044c\u0441\u044f (\u043f\u0440\u0438 \u0431\u043e\u043b\u044c\u0448\u043e\u043c \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u0435 \u0433\u0435\u043d\u0435\u0440\u0438\u0440\u0443\u0435\u043c\u044b\u0445 \u0441\u043b\u0443\u0447\u0430\u0439\u043d\u044b\u0445 \u0432\u0435\u043b\u0438\u0447\u0438\u043d \u043b\u0443\u0447\u0448\u0435 \u043f\u043e\u0441\u0447\u0438\u0442\u0430\u0442\u044c (b \u2014 a) \/ RAND_MAX \u0442\u043e\u043b\u044c\u043a\u043e \u043e\u0434\u0438\u043d \u0440\u0430\u0437):<\/p>\n<pre><code>double Uniform(double a, double b) {     return a + BasicRandGenerator() * (b - a) \/ RAND_MAX; } <\/code><\/pre>\n<p>  \u0420\u0430\u0437\u0443\u043c\u0435\u0435\u0442\u0441\u044f, \u043d\u0435\u043f\u0440\u0435\u0440\u044b\u0432\u043d\u043e\u0441\u0442\u044c \u2014 \u044d\u0442\u043e \u043b\u0438\u0448\u044c \u0430\u0431\u0441\u0442\u0440\u0430\u043a\u0446\u0438\u044f. \u0412 \u0440\u0435\u0430\u043b\u044c\u043d\u043e\u043c \u043c\u0438\u0440\u0435 \u0438 \u0432 \u0434\u0430\u043d\u043d\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u043a\u043e\u043d\u043a\u0440\u0435\u0442\u043d\u043e \u043f\u043e\u0434 \u044d\u0442\u0438\u043c \u043f\u043e\u0434\u0440\u0430\u0437\u0443\u043c\u0435\u0432\u0430\u0435\u0442\u0441\u044f \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u043c\u0430\u043b\u044b\u0439 \u0448\u0430\u0433 \u0434\u0438\u0441\u043a\u0440\u0435\u0442\u0438\u0437\u0430\u0446\u0438\u0438.<\/p>\n<h4>\u041d\u043e\u0440\u043c\u0430\u043b\u044c\u043d\u043e\u0435 \u0440\u0430\u0441\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u0435<\/h4>\n<p>  <\/p>\n<div style=\"text-align:center;\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/files\/37d\/dbf\/53c\/37ddbf53cb9647c7a05f56d103b48be8.png\" \/><\/div>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/files\/4c1\/b82\/f29\/4c1b82f299d94f699445074edf682498.png\"\/><\/p>\n<p>  \u041c\u0435\u0442\u043e\u0434 \u0438\u043d\u0432\u0435\u0440\u0441\u0438\u0438 \u043f\u043e\u0442\u0440\u0435\u0431\u0443\u0435\u0442 \u0432\u044b\u0447\u0438\u0441\u043b\u0435\u043d\u0438\u044f \u043e\u0431\u0440\u0430\u0442\u043d\u043e\u0439 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u043e\u0448\u0438\u0431\u043e\u043a. \u0415\u0441\u043b\u0438 \u043d\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0441\u043f\u0435\u0446\u0438\u0430\u043b\u044c\u043d\u044b\u0435 \u0430\u043f\u043f\u0440\u043e\u043a\u0441\u0438\u043c\u0438\u0440\u0443\u044e\u0449\u0438\u0435 \u0444\u0443\u043d\u043a\u0446\u0438\u0438, \u0441\u043b\u043e\u0436\u043d\u043e \u0438 \u043d\u0435\u0432\u0435\u0440\u043e\u044f\u0442\u043d\u043e \u0434\u043e\u043b\u0433\u043e. \u0414\u043b\u044f \u043d\u043e\u0440\u043c\u0430\u043b\u044c\u043d\u043e\u0439 \u0432\u0435\u043b\u0438\u0447\u0438\u043d\u044b \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u0435\u0442 \u043c\u0435\u0442\u043e\u0434 \u0411\u043e\u043a\u0441\u0430-\u041c\u044e\u043b\u043b\u0435\u0440\u0430. \u041e\u043d \u0434\u043e\u0432\u043e\u043b\u044c\u043d\u043e \u043f\u0440\u043e\u0441\u0442 \u0438 \u0448\u0438\u0440\u043e\u043a\u043e \u0440\u0430\u0441\u043f\u0440\u043e\u0441\u0442\u0440\u0430\u043d\u0435\u043d. \u0415\u0433\u043e \u044f\u0432\u043d\u044b\u0439 \u043d\u0435\u0434\u043e\u0441\u0442\u0430\u0442\u043e\u043a \u2014 \u044d\u0442\u043e \u0432\u044b\u0447\u0438\u0441\u043b\u0435\u043d\u0438\u0435 \u0442\u0440\u0430\u043d\u0441\u0446\u0435\u043d\u0434\u0435\u043d\u0442\u043d\u044b\u0445 \u0444\u0443\u043d\u043a\u0446\u0438\u0439. \u041d\u0430 \u0425\u0430\u0431\u0440\u0435 \u0443\u0436\u0435 \u0443\u043f\u043e\u043c\u0438\u043d\u0430\u043b\u0441\u044f <a href=\"http:\/\/habrahabr.ru\/post\/208684\/\">\u043f\u043e\u043b\u044f\u0440\u043d\u044b\u0439 \u043c\u0435\u0442\u043e\u0434<\/a>, \u043f\u043e\u043c\u043e\u0433\u0430\u044e\u0449\u0438\u0439 \u0438\u0437\u0431\u0435\u0436\u0430\u0442\u044c \u043f\u043e\u0434\u0441\u0447\u0435\u0442\u0430 \u0441\u0438\u043d\u0443\u0441\u0430 \u0438 \u043a\u043e\u0441\u0438\u043d\u0443\u0441\u0430. \u041d\u043e \u043c\u044b \u0432\u0441\u0435 \u0435\u0449\u0435 \u0434\u043e\u043b\u0436\u043d\u044b \u0441\u0447\u0438\u0442\u0430\u0442\u044c \u043b\u043e\u0433\u0430\u0440\u0438\u0444\u043c \u0438 \u043a\u043e\u0440\u0435\u043d\u044c \u0438\u0437 \u043d\u0435\u0433\u043e. \u041a\u0443\u0434\u0430 \u0431\u044b\u0441\u0442\u0440\u0435\u0435 \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u043a\u0440\u0430\u0441\u0438\u0432\u043e \u043d\u0430\u0437\u0432\u0430\u043d\u043d\u044b\u0439 \u043c\u0435\u0442\u043e\u0434 Ziggurat, \u043f\u0440\u0438\u0434\u0443\u043c\u0430\u043d\u043d\u044b\u0439 \u0414\u0436\u043e\u0440\u0434\u0436\u0435\u043c \u041c\u0430\u0440\u0441\u0430\u043b\u044c\u044f, \u0430\u0432\u0442\u043e\u0440\u043e\u043c \u0442\u043e\u0433\u043e \u0436\u0435 \u043f\u043e\u043b\u044f\u0440\u043d\u043e\u0433\u043e \u043c\u0435\u0442\u043e\u0434\u0430.<br \/>  \u041f\u043e\u043b\u044f\u0440\u043d\u044b\u0439 \u043c\u0435\u0442\u043e\u0434 \u2014 \u044d\u0442\u043e \u043f\u0440\u0438\u043c\u0435\u0440 <b>\u0432\u044b\u0431\u043e\u0440\u043a\u0438 \u0441 \u043e\u0442\u043a\u043b\u043e\u043d\u0435\u043d\u0438\u0435\u043c (acceptance-rejection sampling)<\/b>. \u0411\u0443\u043a\u0432\u0430\u043b\u044c\u043d\u043e, \u0432\u044b \u0433\u0435\u043d\u0435\u0440\u0438\u0440\u0443\u0435\u0442\u0435 \u0432\u0435\u043b\u0438\u0447\u0438\u043d\u0443 \u0438 \u043f\u0440\u0438\u043d\u0438\u043c\u0430\u0435\u0442\u0435 \u0435\u0435, \u0435\u0441\u043b\u0438 \u043e\u043d\u0430 \u043f\u043e\u0434\u0445\u043e\u0434\u0438\u0442, \u0438\u043d\u0430\u0447\u0435 \u2014 \u043e\u0442\u043a\u043b\u043e\u043d\u044f\u0435\u0442\u0435 \u0438 \u0433\u0435\u043d\u0435\u0440\u0438\u0440\u0443\u0435\u0442\u0435 \u0435\u0449\u0435 \u0440\u0430\u0437. \u041e\u0441\u043d\u043e\u0432\u043d\u043e\u0439 \u043f\u0440\u0438\u043c\u0435\u0440: \u043d\u0443\u0436\u043d\u043e \u0441\u0433\u0435\u043d\u0435\u0440\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0441\u043b\u0443\u0447\u0430\u0439\u043d\u0443\u044e \u0432\u0435\u043b\u0438\u0447\u0438\u043d\u0443 \u0441 \u043f\u043b\u043e\u0442\u043d\u043e\u0441\u0442\u044c\u044e f(x), \u043e\u0434\u043d\u0430\u043a\u043e \u044d\u0442\u043e \u0441\u043b\u0438\u0448\u043a\u043e\u043c \u0441\u043b\u043e\u0436\u043d\u043e \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u043f\u0440\u043e\u0441\u0442\u044b\u043c \u043c\u0435\u0442\u043e\u0434\u043e\u043c \u0438\u043d\u0432\u0435\u0440\u0441\u0438\u0438. \u0417\u0430\u0442\u043e, \u0432\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u0441\u0433\u0435\u043d\u0435\u0440\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0441\u043b\u0443\u0447\u0430\u0439\u043d\u0443\u044e \u0432\u0435\u043b\u0438\u0447\u0438\u043d\u0443 \u0441 \u043f\u043b\u043e\u0442\u043d\u043e\u0441\u0442\u044c\u044e g(x), \u043d\u0435 \u043e\u0447\u0435\u043d\u044c \u0441\u0438\u043b\u044c\u043d\u043e \u043e\u0442\u043b\u0438\u0447\u0430\u044e\u0449\u0435\u0439\u0441\u044f \u043e\u0442 f(x). \u0412 \u0442\u0430\u043a\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u0432\u044b \u0431\u0435\u0440\u0435\u0442\u0435 \u043d\u0430\u0438\u043c\u0435\u043d\u044c\u0448\u0443\u044e \u043a\u043e\u043d\u0441\u0442\u0430\u043d\u0442\u0443 M, \u0442\u0430\u043a\u0443\u044e \u0447\u0442\u043e M &gt; 1 \u0438 \u043f\u043e\u0447\u0442\u0438 \u0432\u0441\u044e\u0434\u0443 f(x) &lt; Mg(x), \u0438 \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u0442\u0435 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0439 \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c:<\/p>\n<ul>\n<li>\u0413\u0435\u043d\u0435\u0440\u0438\u0440\u0443\u0435\u043c \u0441\u043b\u0443\u0447\u0430\u0439\u043d\u0443\u044e \u0432\u0435\u043b\u0438\u0447\u0438\u043d\u0443 X \u0438\u0437 \u0440\u0430\u0441\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u044f g(x) \u0438 \u0441\u043b\u0443\u0447\u0430\u0439\u043d\u0443\u044e \u0432\u0435\u043b\u0438\u0447\u0438\u043d\u0443 U, \u0440\u0430\u0432\u043d\u043e\u043c\u0435\u0440\u043d\u043e \u0440\u0430\u0441\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u043d\u0443\u044e \u043e\u0442 0 \u0434\u043e 1.<\/li>\n<li>\u0415\u0441\u043b\u0438 U &lt; f(X) \/ Mg(X) \u2014 \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u043c X, \u0438\u043d\u0430\u0447\u0435 \u2014 \u043f\u043e\u0432\u0442\u043e\u0440\u044f\u0435\u043c \u0437\u0430\u043d\u043e\u0432\u043e. <\/li>\n<\/ul>\n<p>  \u0412\u0435\u0440\u043e\u044f\u0442\u043d\u043e\u0441\u0442\u044c \u043f\u0440\u0438\u043d\u044f\u0442\u044c \u0441\u043b\u0443\u0447\u0430\u0439\u043d\u0443\u044e \u0432\u0435\u043b\u0438\u0447\u0438\u043d\u0443:<\/p>\n<div style=\"text-align:center;\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/files\/f36\/9f9\/1a2\/f369f91a23a74cfba2c052d76f8bffb8.png\" \/><\/div>\n<p>  \u0427\u0435\u043c \u043c\u0435\u043d\u044c\u0448\u0435 \u0432\u044b \u0432\u044b\u0431\u0435\u0440\u0435\u0442\u0435 M \u2014 \u0442\u0435\u043c \u0431\u043e\u043b\u044c\u0448\u0435 \u044d\u0442\u0430 \u0432\u0435\u0440\u043e\u044f\u0442\u043d\u043e\u0441\u0442\u044c \u2014 \u0442\u0435\u043c \u0431\u044b\u0441\u0442\u0440\u0435\u0435 \u0431\u0443\u0434\u0435\u0442 \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u0433\u0435\u043d\u0435\u0440\u0430\u0442\u043e\u0440. <\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">\u0414\u043e\u043a\u0430\u0437\u0430\u0442\u0435\u043b\u044c\u0441\u0442\u0432\u043e \u0440\u0430\u0431\u043e\u0442\u044b \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u0430:<\/b><\/p>\n<div class=\"spoiler_text\">\u0412\u043e\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0432\u0448\u0438\u0441\u044c \u0442\u0435\u043c, \u0447\u0442\u043e \u0432\u0435\u0440\u043e\u044f\u0442\u043d\u043e\u0441\u0442\u044c \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0436\u0434\u0435\u043d\u0438\u044f \u0434\u0432\u0443\u0445 \u0441\u043e\u0431\u044b\u0442\u0438\u0439 \u0410 \u0438 B \u0440\u0430\u0432\u043d\u0430<\/p>\n<div style=\"text-align:center;\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/files\/39e\/e7e\/cd5\/39ee7ecd501f48a4b894cb3beaf1106e.png\" \/><\/div>\n<p>  \u0432\u044b\u0447\u0438\u0441\u043b\u0438\u043c \u0432\u0435\u0440\u043e\u044f\u0442\u043d\u043e\u0441\u0442\u044c \u043f\u0440\u0438\u043d\u044f\u0442\u0438\u044f \u0441\u043b\u0443\u0447\u0430\u0439\u043d\u043e\u0439 \u0432\u0435\u043b\u0438\u0447\u0438\u043d\u044b X \u0441 \u0444\u0443\u043d\u043a\u0446\u0438\u0435\u0439 \u043f\u043b\u043e\u0442\u043d\u043e\u0441\u0442\u0438 \u0440\u0430\u0441\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u044f g(x) \u0438 \u0444\u0443\u043d\u043a\u0446\u0438\u0435\u0439 \u0440\u0430\u0441\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u044f G(x), \u043d\u043e \u0443\u0436\u0435 \u043f\u0440\u0438 \u0443\u0441\u043b\u043e\u0432\u0438\u0438, \u0447\u0442\u043e \u043e\u043d\u0430 \u043c\u0435\u043d\u044c\u0448\u0435 \u043d\u0435\u043a\u043e\u0433\u043e \u0437\u0430\u0434\u0430\u043d\u043d\u043e\u0433\u043e \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u0430 x:<\/p>\n<div style=\"text-align:center;\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/files\/39a\/214\/0f7\/39a2140f72944aa8b10b1937a2c62006.png\" \/><\/div>\n<p>  \u0418 \u0442\u043e\u0433\u0434\u0430 \u043f\u043e \u0442\u0435\u043e\u0440\u0435\u043c\u0435 \u0411\u0430\u0439\u0435\u0441\u0430:<\/p>\n<div style=\"text-align:center;\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/files\/1e6\/961\/29b\/1e696129b9be44369efe70db3fab4b7d.png\" \/><\/div>\n<p>  <\/div>\n<\/div>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/files\/f34\/cdd\/4ce\/f34cdd4cebc74954995a19eeba770dc8.png\" align=\"right\"\/><br \/>  \u0414\u043b\u044f \u043f\u0440\u0438\u043c\u0435\u0440\u0430 \u0441\u0433\u0435\u043d\u0435\u0440\u0438\u0440\u0443\u0435\u043c \u043c\u043e\u0434\u0443\u043b\u044c \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u043e\u0439 \u043d\u043e\u0440\u043c\u0430\u043b\u044c\u043d\u043e\u0439 \u0432\u0435\u043b\u0438\u0447\u0438\u043d\u044b. \u0412 \u0441\u0438\u043b\u0443 \u0441\u0438\u043c\u043c\u0435\u0442\u0440\u0438\u0438 \u043d\u043e\u0440\u043c\u0430\u043b\u044c\u043d\u043e\u0433\u043e \u0440\u0430\u0441\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u044f \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u043d\u0443\u044e \u0432\u0435\u043b\u0438\u0447\u0438\u043d\u0443 \u043c\u043e\u0436\u043d\u043e \u0443\u043c\u043d\u043e\u0436\u0438\u0442\u044c \u043d\u0430 \u0441\u043b\u0443\u0447\u0430\u0439\u043d\u0443\u044e \u0432\u0435\u043b\u0438\u0447\u0438\u043d\u0443, \u043f\u0440\u0438\u043d\u0438\u043c\u0430\u044e\u0449\u0443\u044e \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f +1 \u0438 -1 \u0441 \u0440\u0430\u0432\u043d\u044b\u043c\u0438 \u0432\u0435\u0440\u043e\u044f\u0442\u043d\u043e\u0441\u0442\u044f\u043c\u0438, \u0438 \u0442\u0430\u043a\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u0443\u044e \u043d\u043e\u0440\u043c\u0430\u043b\u044c\u043d\u043e \u0440\u0430\u0441\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u043d\u0443\u044e \u0432\u0435\u043b\u0438\u0447\u0438\u043d\u0443 X. \u041b\u044e\u0431\u0430\u044f \u043d\u043e\u0440\u043c\u0430\u043b\u044c\u043d\u0430\u044f \u0432\u0435\u043b\u0438\u0447\u0438\u043d\u0430 \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u0442\u0441\u044f \u0438\u0437 \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u043e\u0439 \u0443\u043c\u043d\u043e\u0436\u0435\u043d\u0438\u0435\u043c \u043d\u0430 sigma \u0438 \u0441\u0434\u0432\u0438\u0433\u043e\u043c \u043d\u0430 mu. \u0424\u0443\u043d\u043a\u0446\u0438\u044f \u043f\u043b\u043e\u0442\u043d\u043e\u0441\u0442\u0438 \u0440\u0430\u0441\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u044f |X|:<\/p>\n<div style=\"text-align:center;\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/files\/7fc\/abf\/6f6\/7fcabf6f6332427d9bb768e5d523072b.png\" \/><\/div>\n<p>  \u041f\u043e\u043f\u044b\u0442\u0430\u0435\u043c\u0441\u044f \u0435\u0451 \u043f\u0440\u0438\u0431\u043b\u0438\u0437\u0438\u0442\u044c \u0444\u0443\u043d\u043a\u0446\u0438\u0435\u0439 \u043f\u043b\u043e\u0442\u043d\u043e\u0441\u0442\u0438 \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u043e\u0433\u043e \u044d\u043a\u0441\u043f\u043e\u043d\u0435\u043d\u0446\u0438\u0430\u043b\u044c\u043d\u043e\u0433\u043e \u0440\u0430\u0441\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u044f. \u042f \u043d\u0435\u043c\u043d\u043e\u0433\u043e \u0437\u0430\u0431\u0435\u0433\u0430\u044e \u0432\u043f\u0435\u0440\u0435\u0434, \u0442\u0430\u043a \u043a\u0430\u043a \u043e\u0431 \u044d\u043a\u0441\u043f\u043e\u043d\u0435\u043d\u0446\u0438\u0430\u043b\u044c\u043d\u043e\u043c \u0440\u0430\u0441\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u0438 \u0435\u0449\u0435 \u043d\u0435 \u0433\u043e\u0432\u043e\u0440\u0438\u043b. \u041e\u043d\u043e \u0433\u0435\u043d\u0435\u0440\u0438\u0440\u0443\u0435\u0442\u0441\u044f \u043f\u0440\u043e\u0441\u0442\u043e \u2014 \u0431\u0435\u0440\u0435\u043c \u0440\u0430\u0432\u043d\u043e\u043c\u0435\u0440\u043d\u043e \u0440\u0430\u0441\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u043d\u0443\u044e \u043d\u0430 [0, 1] \u0432\u0435\u043b\u0438\u0447\u0438\u043d\u0443 U \u0438 \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u043c -ln(U).<\/p>\n<div style=\"text-align:center;\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/files\/335\/83c\/269\/33583c269a314210b86f1574f34c8f5b.png\" \/><\/div>\n<p>  \u041c\u0438\u043d\u0438\u043c\u0430\u043b\u044c\u043d\u043e\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u041c, \u0443\u0434\u043e\u0432\u043b\u0435\u0442\u0432\u043e\u0440\u044f\u044e\u0449\u0435\u0435 \u0443\u0441\u043b\u043e\u0432\u0438\u044e f(x) &lt; Mg(x), \u0434\u043e\u0441\u0442\u0438\u0433\u0430\u0435\u0442\u0441\u044f \u043f\u0440\u0438 x = 1:<\/p>\n<div style=\"text-align:center;\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/files\/f29\/c1a\/1f9\/f29c1a1f9b9c442e91cd8503038c5dee.png\" \/><\/div>\n<p>  \u0422\u043e\u0433\u0434\u0430:<\/p>\n<div style=\"text-align:center;\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/files\/16d\/9a6\/76c\/16d9a676c3d44c2c90b476de53e499a7.png\" \/><\/div>\n<p>  \u0418 \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c \u0434\u043b\u044f \u0433\u0435\u043d\u0435\u0440\u0430\u0446\u0438\u0438 \u043d\u043e\u0440\u043c\u0430\u043b\u044c\u043d\u043e\u0439 \u0441\u043b\u0443\u0447\u0430\u0439\u043d\u043e\u0439 \u0432\u0435\u043b\u0438\u0447\u0438\u043d\u044b \u0431\u0443\u0434\u0435\u0442 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u043c:<\/p>\n<ol>\n<li> \u0413\u0435\u043d\u0435\u0440\u0438\u0440\u0443\u0435\u043c U \u2014 \u0440\u0430\u0432\u043d\u043e\u043c\u0435\u0440\u043d\u043e \u0440\u0430\u0441\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u043d\u0443\u044e \u043d\u0430 [0, 1] \u0441\u043b\u0443\u0447\u0430\u0439\u043d\u0443\u044e \u0432\u0435\u043b\u0438\u0447\u0438\u043d\u0443. <\/li>\n<li> \u0413\u0435\u043d\u0435\u0440\u0438\u0440\u0443\u0435\u043c \u044d\u043a\u0441\u043f\u043e\u043d\u0435\u043d\u0446\u0438\u0430\u043b\u044c\u043d\u043e \u0440\u0430\u0441\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u043d\u0443\u044e \u0441\u043b\u0443\u0447\u0430\u0439\u043d\u0443\u044e \u0432\u0435\u043b\u0438\u0447\u0438\u043d\u0443 E (\u043e\u0431 \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u0435, \u0431\u043e\u043b\u0435\u0435 \u0431\u044b\u0441\u0442\u0440\u043e\u043c, \u0447\u0435\u043c \u043f\u043e\u0434\u0441\u0447\u0435\u0442 -ln(U), \u0440\u0430\u0441\u0441\u043a\u0430\u0436\u0443 \u0434\u0430\u043b\u0435\u0435). <\/li>\n<li> \u0415\u0441\u043b\u0438 U &lt; e^{-(E \u2014 1)^2\/2} \u2014 \u0442\u043e |X| = E, \u0438\u043d\u0430\u0447\u0435 \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u043c\u0441\u044f \u043d\u0430 \u043f\u0435\u0440\u0432\u044b\u0439 \u0448\u0430\u0433.<\/li>\n<li> \u0413\u0435\u043d\u0435\u0440\u0438\u0440\u0443\u0435\u043c \u043d\u043e\u0432\u0443\u044e U. \u0415\u0441\u043b\u0438 U &lt; 0.5, \u0442\u043e \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u043c -|X|, \u0438\u043b\u0438 \u0436\u0435 |X| \u0432 \u0434\u0440\u0443\u0433\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435.<\/li>\n<\/ol>\n<p>  \u041d\u0435\u0441\u043b\u043e\u0436\u043d\u043e \u0437\u0430\u043c\u0435\u0442\u0438\u0442\u044c, \u0447\u0442\u043e:<\/p>\n<div style=\"text-align:center;\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/files\/e94\/058\/7e4\/e940587e48164083b303ab73b4fbc8e5.png\" \/><\/div>\n<p>  \u0410 \u044d\u0442\u043e \u0437\u043d\u0430\u0447\u0438\u0442, \u0447\u0442\u043e \u0432\u043c\u0435\u0441\u0442\u043e U \u043c\u043e\u0436\u043d\u043e \u0441\u0433\u0435\u043d\u0435\u0440\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0435\u0449\u0435 \u043e\u0434\u043d\u0443 \u044d\u043a\u0441\u043f\u043e\u043d\u0435\u043d\u0446\u0438\u0430\u043b\u044c\u043d\u043e \u0440\u0430\u0441\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u043d\u0443\u044e \u0432\u0435\u043b\u0438\u0447\u0438\u043d\u0443 \u0438 \u043d\u0435 \u0441\u0447\u0438\u0442\u0430\u0442\u044c \u043f\u043e\u043a\u0430\u0437\u0430\u0442\u0435\u043b\u044c\u043d\u0443\u044e \u0444\u0443\u043d\u043a\u0446\u0438\u044e. \u041d\u043e\u0432\u044b\u0439 \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c \u0431\u0443\u0434\u0435\u0442 \u0432\u044b\u0433\u043b\u044f\u0434\u0435\u0442\u044c \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c:<\/p>\n<ol>\n<li>\u0413\u0435\u043d\u0435\u0440\u0438\u0440\u0443\u0435\u043c \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u044b\u0435 \u044d\u043a\u0441\u043f\u043e\u043d\u0435\u043d\u0446\u0438\u0430\u043b\u044c\u043d\u043e \u0440\u0430\u0441\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u043d\u044b\u0435 \u0441\u043b\u0443\u0447\u0430\u0439\u043d\u044b\u0439 \u0432\u0435\u043b\u0438\u0447\u0438\u043d\u044b E1 \u0438 E2.<\/li>\n<li>\u0415\u0441\u043b\u0438 E2 &gt; (E1 \u2014 1)^2 \/ 2, \u0442\u043e \u043f\u0440\u0438\u043d\u0438\u043c\u0430\u0435\u043c |X| = E1, \u0438\u043d\u0430\u0447\u0435 \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u043c\u0441\u044f \u043d\u0430\u0437\u0430\u0434.<\/li>\n<li> \u0413\u0435\u043d\u0435\u0440\u0438\u0440\u0443\u0435\u043c U. \u0415\u0441\u043b\u0438 U &lt; 0.5, \u0442\u043e \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u043c -|X|, \u0438\u043b\u0438 \u0436\u0435 |X| \u0432 \u0434\u0440\u0443\u0433\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435.<\/li>\n<\/ol>\n<p>  \u0415\u0449\u0435 \u043e\u0434\u0438\u043d \u043c\u043e\u043c\u0435\u043d\u0442: \u043f\u0440\u0438 \u0443\u0441\u043b\u043e\u0432\u0438\u0438 \u043f\u0440\u0438\u043d\u044f\u0442\u0438\u044f \u0432\u0435\u043b\u0438\u0447\u0438\u043d\u044b E1 \u0440\u0430\u0437\u043d\u0438\u0446\u0430 E2 \u2014 (E1 \u2014 1)^2 \/ 2 \u0431\u0443\u0434\u0435\u0442 \u0442\u0430\u043a\u0436\u0435 \u0440\u0430\u0441\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0430 \u044d\u043a\u0441\u043f\u043e\u043d\u0435\u043d\u0446\u0438\u0430\u043b\u044c\u043d\u043e \u0438 \u043d\u0435\u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e \u043e\u0442 E1. \u041f\u043e\u044d\u0442\u043e\u043c\u0443 \u0435\u0451 \u043c\u043e\u0436\u043d\u043e \u0437\u0430\u043f\u043e\u043c\u043d\u0438\u0442\u044c \u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0432 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0439 \u0440\u0430\u0437 \u0432\u043c\u0435\u0441\u0442\u043e E1.<\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">\u0414\u043e\u043a\u0430\u0437\u0430\u0442\u0435\u043b\u044c\u0441\u0442\u0432\u043e<\/b><\/p>\n<div class=\"spoiler_text\">\u042d\u043a\u0441\u043f\u043e\u043d\u0435\u043d\u0446\u0438\u0430\u043b\u044c\u043d\u043e\u0435 \u0440\u0430\u0441\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u0435 \u043e\u0431\u043b\u0430\u0434\u0430\u0435\u0442 \u0441\u0432\u043e\u0439\u0441\u0442\u0432\u043e\u043c \u043e\u0442\u0441\u0443\u0442\u0441\u0442\u0432\u0438\u044f \u043f\u0430\u043c\u044f\u0442\u0438:<\/p>\n<div style=\"text-align:center;\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/files\/b4d\/ff1\/22e\/b4dff122edd140a2b3d8b9ccb38bd417.png\" \/><\/div>\n<p>  \u0410 \u044d\u0442\u043e \u043e\u0437\u043d\u0430\u0447\u0430\u0435\u0442, \u0447\u0442\u043e \u0444\u0443\u043d\u043a\u0446\u0438\u044f \u0440\u0430\u0441\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u044f \u0440\u0430\u0437\u043d\u0438\u0446\u044b:<\/p>\n<div style=\"text-align:center;\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/files\/858\/15c\/558\/85815c558051415fb31cf4797125e9ea.png\" \/><\/div>\n<p>  <\/div>\n<\/div>\n<p>  \u041e\u0431\u0449\u0430\u044f \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u0430 \u0432\u044b\u0431\u043e\u0440\u043a\u0438 \u0441 \u043e\u0442\u043a\u043b\u043e\u043d\u0435\u043d\u0438\u0435\u043c \u0437\u0430\u043a\u043b\u044e\u0447\u0430\u0435\u0442\u0441\u044f \u0432 \u043f\u043e\u0434\u0431\u043e\u0440\u0435 \u0442\u0430\u043a\u043e\u0439 \u0441\u043b\u0443\u0447\u0430\u0439\u043d\u043e\u0439 \u0432\u0435\u043b\u0438\u0447\u0438\u043d\u044b \u0441 \u043f\u043b\u043e\u0442\u043d\u043e\u0441\u0442\u044c\u044e \u0440\u0430\u0441\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u044f g(x), \u0447\u0442\u043e\u0431\u044b \u043e\u0442\u043a\u043b\u043e\u043d\u0435\u043d\u0438\u0439 \u0431\u044b\u043b\u043e \u043a\u0430\u043a \u043c\u043e\u0436\u043d\u043e \u043c\u0435\u043d\u044c\u0448\u0435. \u0414\u043b\u044f \u0440\u0435\u0448\u0435\u043d\u0438\u044f \u044d\u0442\u043e\u0439 \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u044b \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u0435\u0442 \u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u043e \u0440\u0430\u0441\u0448\u0438\u0440\u0435\u043d\u0438\u0439. \u0421\u0430\u043c \u0436\u0435 \u043c\u0435\u0442\u043e\u0434 \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u043e\u0441\u043d\u043e\u0432\u043e\u0439 \u0434\u043b\u044f \u043f\u043e\u0447\u0442\u0438 \u0432\u0441\u0435 \u043f\u043e\u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0445 \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u043e\u0432, \u0432\u043a\u043b\u044e\u0447\u0430\u044f Ziggurat. \u0421\u0443\u0442\u044c \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u0435\u0433\u043e \u0432\u0441\u0435 \u0442\u0430 \u0436\u0435: \u043f\u044b\u0442\u0430\u0435\u043c\u0441\u044f \u043f\u043e\u043a\u0440\u044b\u0442\u044c \u0444\u0443\u043d\u043a\u0446\u0438\u044e \u043f\u043b\u043e\u0442\u043d\u043e\u0441\u0442\u0438 \u043d\u043e\u0440\u043c\u0430\u043b\u044c\u043d\u043e\u0433\u043e \u0440\u0430\u0441\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u044f \u043f\u043e\u0445\u043e\u0436\u0435\u0439 \u0438 \u0431\u043e\u043b\u0435\u0435 \u043f\u0440\u043e\u0441\u0442\u043e\u0439 \u0444\u0443\u043d\u043a\u0446\u0438\u0435\u0439 \u0438 \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u043c \u0432\u0435\u043b\u0438\u0447\u0438\u043d\u044b, \u043f\u043e\u043f\u0430\u0432\u0448\u0438\u0435 \u043f\u043e\u0434 \u043a\u0440\u0438\u0432\u0443\u044e. \u0424\u0443\u043d\u043a\u0446\u0438\u044f \u0441\u0432\u043e\u0435\u043e\u0431\u0440\u0430\u0437\u043d\u0430\u044f \u0438 \u043d\u0430\u043f\u043e\u043c\u0438\u043d\u0430\u0435\u0442 \u043c\u043d\u043e\u0433\u043e\u0441\u0442\u0443\u043f\u0435\u043d\u0447\u0430\u0442\u043e\u0435 \u0441\u043e\u043e\u0440\u0443\u0436\u0435\u043d\u0438\u0435, \u043e\u0442\u043a\u0443\u0434\u0430, \u0441\u043e\u0431\u0441\u0442\u0432\u0435\u043d\u043d\u043e, \u0438 \u0442\u0430\u043a\u043e\u0435 \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u0435 \u0443 \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u0430.<\/p>\n<p>  <img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/files\/ab0\/a18\/218\/ab0a18218b3f49dabf712e2b1f7892fc.png\" align=\"right\" height=\"220\" width=\"380\"\/><br \/>  \u0417\u0438\u043a\u043a\u0443\u0440\u0430\u0442 \u0441\u043e\u043e\u0440\u0443\u0436\u0430\u0435\u0442\u0441\u044f \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c. \u0423 \u043f\u043e\u0434\u043d\u043e\u0436\u044c\u044f \u0444\u0443\u043d\u043a\u0446\u0438\u0438 f(x) \u0432\u044b\u0431\u0438\u0440\u0430\u044e\u0442\u0441\u044f \u0442\u043e\u0447\u043a\u0438 x1 \u0438 y0 = f(x1). \u041f\u043b\u043e\u0449\u0430\u0434\u044c \u043f\u043e\u0434 \u043f\u0440\u044f\u043c\u043e\u0443\u0433\u043e\u043b\u044c\u043d\u0438\u043a\u043e\u043c \u043e\u0442 (0,0) \u0434\u043e (x1, y0) + \u043f\u043b\u043e\u0449\u0430\u0434\u044c \u043f\u043e\u0434 \u0445\u0432\u043e\u0441\u0442\u043e\u043c \u0444\u0443\u043d\u043a\u0446\u0438\u0438 f(x &gt; x1) = \u0410. \u0422\u0430\u043a \u043c\u044b \u043f\u043e\u0441\u0442\u0440\u043e\u0438\u043b\u0438 \u0431\u0430\u0437\u043e\u0432\u044b\u0439 \u0441\u043b\u043e\u0439. \u041f\u043e\u0432\u0435\u0440\u0445 \u043d\u0435\u0433\u043e \u0441\u0442\u0430\u0432\u0438\u0442\u0441\u044f \u0435\u0449\u0435 \u043e\u0434\u0438\u043d \u043f\u0440\u044f\u043c\u043e\u0443\u0433\u043e\u043b\u044c\u043d\u0438\u043a, \u0442\u0430\u043a\u043e\u0439, \u0447\u0442\u043e \u0435\u0433\u043e \u0448\u0438\u0440\u0438\u043d\u0430 x1, \u0430 \u0432\u044b\u0441\u043e\u0442\u0430 y1 = A\/y0 \u0438 \u0442\u0430\u043a\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c \u0435\u0433\u043e \u043f\u043b\u043e\u0449\u0430\u0434\u044c \u0431\u0443\u0434\u0435\u0442 \u0440\u0430\u0432\u043d\u0430 A. \u042d\u0442\u043e\u0442 \u043f\u0440\u044f\u043c\u043e\u0443\u0433\u043e\u043b\u044c\u043d\u0438\u043a \u0443\u0436\u0435 \u0432\u043a\u043b\u044e\u0447\u0430\u0435\u0442 \u0432 \u0441\u0435\u0431\u044f \u0442\u043e\u0447\u043a\u0438, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043b\u0435\u0436\u0430\u0442 \u0432\u044b\u0448\u0435 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 f(x), \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440 (x1, y1). \u0424\u0443\u043d\u043a\u0446\u0438\u044e f(x) \u0432\u0442\u043e\u0440\u043e\u0439 \u043f\u0440\u044f\u043c\u043e\u0443\u0433\u043e\u043b\u044c\u043d\u0438\u043a \u043f\u0435\u0440\u0435\u0441\u0435\u043a\u0430\u0435\u0442 \u0432 \u0442\u043e\u0447\u043a\u0435 (x2, y1) \u2014 \u044d\u0442\u043e \u0431\u0443\u0434\u0435\u0442 \u043a\u043e\u043e\u0440\u0434\u0438\u043d\u0430\u0442\u0430 \u043d\u0438\u0436\u043d\u0435\u0439 \u043f\u0440\u0430\u0432\u043e\u0439 \u0442\u043e\u0447\u043a\u0438 \u0442\u0440\u0435\u0442\u044c\u0435\u0433\u043e \u043f\u0440\u044f\u043c\u043e\u0443\u0433\u043e\u043b\u044c\u043d\u0438\u043a\u0430, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043d\u0430\u043a\u043b\u0430\u0434\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u0442\u0430\u043a\u0438\u043c \u0436\u0435 \u043e\u0431\u0440\u0430\u0437\u043e\u043c \u043a\u0430\u043a \u0438 \u0432\u0442\u043e\u0440\u043e\u0439, \u0447\u0442\u043e\u0431\u044b \u0435\u0433\u043e \u043f\u043b\u043e\u0449\u0430\u0434\u044c \u0431\u044b\u043b\u0430 \u0440\u0430\u0432\u043d\u0430 \u0410. \u0422\u0430\u043a \u043f\u0440\u043e\u0434\u043e\u043b\u0436\u0430\u0435\u0442\u0441\u044f \u0434\u043e \u0442\u0435\u0445 \u043f\u043e\u0440, \u043f\u043e\u043a\u0430 \u043c\u044b \u043d\u0435 \u043f\u043e\u0441\u0442\u0440\u043e\u0438\u043c \u0417\u0438\u043a\u043a\u0443\u0440\u0430\u0442 \u0434\u043e \u0432\u0435\u0440\u0448\u0438\u043d\u044b \u0444\u0443\u043d\u043a\u0446\u0438\u0438. \u041f\u043b\u043e\u0449\u0430\u0434\u044c \u043a\u0430\u0436\u0434\u043e\u0439 \u0441\u0442\u0443\u043f\u0435\u043d\u0438 \u0431\u0443\u0434\u0435\u0442 \u0440\u0430\u0432\u043d\u0430 \u0410. \u0414\u0430\u043b\u044c\u043d\u0435\u0439\u0448\u0438\u0439 \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c <i>(\u0431\u0435\u0437 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0438 \u043f\u043e\u043f\u0430\u0434\u0430\u043d\u0438\u044f \u0432 \u0431\u0430\u0437\u043e\u0432\u044b\u0439 \u0441\u043b\u043e\u0439)<\/i>:<\/p>\n<ol>\n<li>\u0421\u043b\u0443\u0447\u0430\u0439\u043d\u043e \u0438 \u0440\u0430\u0432\u043d\u043e\u043c\u0435\u0440\u043d\u043e \u0432\u044b\u0431\u0438\u0440\u0430\u0435\u0442\u0441\u044f \u043f\u0440\u044f\u043c\u043e\u0443\u0433\u043e\u043b\u044c\u043d\u0438\u043a i \u0438 \u0433\u0435\u043d\u0435\u0440\u0438\u0440\u0443\u0435\u0442\u0441\u044f \u0440\u0430\u0432\u043d\u043e\u043c\u0435\u0440\u043d\u043e \u0440\u0430\u0441\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u043d\u0430\u044f \u0432\u0435\u043b\u0438\u0447\u0438\u043d\u0430 X \u043e\u0442 0 \u0434\u043e x_i.<\/li>\n<li>\u0415\u0441\u043b\u0438 X &lt; x_{i+1}, \u0442\u043e \u043c\u044b \u0442\u043e\u0447\u043d\u043e \u043f\u043e\u043f\u0430\u043b\u0438 \u043f\u043e\u0434 \u043a\u0440\u0438\u0432\u0443\u044e \u2014 \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u043c X.<\/li>\n<li>\u0413\u0435\u043d\u0435\u0440\u0438\u0440\u0443\u0435\u043c \u043d\u043e\u0432\u0443\u044e \u0440\u0430\u0432\u043d\u043e\u043c\u0435\u0440\u043d\u043e \u0440\u0430\u0441\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u043d\u0443\u044e \u0432\u0435\u043b\u0438\u0447\u0438\u043d\u0443 Y \u043e\u0442 y_i \u0434\u043e y _{i + 1}. \u0415\u0441\u043b\u0438 \u0442\u043e\u0447\u043a\u0430 \u0441 \u043a\u043e\u043e\u0440\u0434\u0438\u043d\u0430\u0442\u0430\u043c\u0438 (X, Y) \u043b\u0435\u0436\u0438\u0442 \u043f\u043e\u0434 \u043a\u0440\u0438\u0432\u043e\u0439, \u0442\u043e \u0435\u0441\u0442\u044c Y &lt; f(X) \u2014 \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u043c X. \u0418\u043d\u0430\u0447\u0435 \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u043c\u0441\u044f \u043d\u0430 \u043f\u0435\u0440\u0432\u044b\u0439 \u0448\u0430\u0433.<\/li>\n<\/ol>\n<p>  \u0427\u0442\u043e \u0434\u0435\u043b\u0430\u0442\u044c \u0435\u0441\u043b\u0438 \u043f\u043e\u043f\u0430\u043b\u0438 \u0432 \u0431\u0430\u0437\u043e\u0432\u044b\u0439 \u0441\u043b\u043e\u0439? \u0418\u0437 \u043d\u0435\u0433\u043e \u0442\u0430\u043a\u0436\u0435 \u043c\u043e\u0436\u043d\u043e \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u043f\u0440\u044f\u043c\u043e\u0443\u0433\u043e\u043b\u044c\u043d\u0438\u043a \u0441 \u043f\u043b\u043e\u0449\u0430\u0434\u044c\u044e \u0410, \u0432\u0432\u0435\u0434\u044f \u043c\u043d\u0438\u043c\u0443\u044e \u0442\u043e\u0447\u043a\u0443 x0 = A\/y0. \u0422\u043e\u0433\u0434\u0430 \u043f\u043b\u043e\u0449\u0430\u0434\u044c \u043f\u0440\u044f\u043c\u043e\u0443\u0433\u043e\u043b\u044c\u043d\u0438\u043a\u0430 \u043e\u0442 (0,0) \u0434\u043e (x0, y0) \u0431\u0443\u0434\u0435\u0442 \u0442\u0430\u043a\u0436\u0435 \u0440\u0430\u0432\u043d\u044f\u0442\u044c\u0441\u044f \u0410. \u0420\u0430\u0437\u043d\u0438\u0446\u0430 \u0432 \u0431\u0430\u0437\u043e\u0432\u043e\u043c \u0441\u043b\u043e\u0435 \u0432 \u0442\u043e\u043c, \u0447\u0442\u043e \u0435\u0441\u043b\u0438 \u043c\u044b \u043d\u0435 \u043f\u043e\u043f\u0430\u043b\u0438 \u043f\u043e\u0434 \u043a\u0440\u0438\u0432\u0443\u044e \u0432 \u043d\u043e\u0432\u043e\u043c \u043c\u043d\u0438\u043c\u043e\u043c \u043f\u0440\u044f\u043c\u043e\u0443\u0433\u043e\u043b\u044c\u043d\u0438\u043a\u0435, \u0442\u043e \u043c\u044b \u0435\u0449\u0435 \u043d\u0435 \u0434\u043e\u043b\u0436\u043d\u044b \u043e\u0442\u043a\u043b\u043e\u043d\u044f\u0442\u044c x \u2014 \u043c\u044b \u043b\u0438\u0448\u044c \u043f\u043e\u043f\u0430\u043b\u0438 \u0432 \u0445\u0432\u043e\u0441\u0442. \u0414\u043b\u044f \u0445\u0432\u043e\u0441\u0442\u0430 \u0414\u0436\u043e\u0440\u0434\u0436 \u041c\u0430\u0440\u0441\u0430\u043b\u044c\u044f \u043f\u0440\u0435\u0434\u043b\u0430\u0433\u0430\u0435\u0442 \u0432\u043e\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c\u0441\u044f \u0442\u0435\u043c \u0436\u0435 \u043c\u0435\u0442\u043e\u0434\u043e\u043c, \u0447\u0442\u043e \u043c\u044b \u0440\u0430\u0441\u0441\u043c\u0430\u0442\u0440\u0438\u0432\u0430\u043b\u0438 \u0434\u043e \u044d\u0442\u043e\u0433\u043e \u2014 \u0432\u044b\u0431\u043e\u0440\u043a\u043e\u0439 \u0441 \u043e\u0442\u043a\u043b\u043e\u043d\u0435\u043d\u0438\u0435\u043c. \u0422\u043e\u043b\u044c\u043a\u043e \u0441 \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u043c\u0438 \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u044f\u043c\u0438:<\/p>\n<ol>\n<li>\u0413\u0435\u043d\u0435\u0440\u0438\u0440\u0443\u0435\u043c \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u044b\u0435 \u044d\u043a\u0441\u043f\u043e\u043d\u0435\u043d\u0446\u0438\u0430\u043b\u044c\u043d\u043e \u0440\u0430\u0441\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u043d\u044b\u0435 \u0441\u043b\u0443\u0447\u0430\u0439\u043d\u044b\u0439 \u0432\u0435\u043b\u0438\u0447\u0438\u043d\u044b E1 \u0441 \u043f\u043b\u043e\u0442\u043d\u043e\u0441\u0442\u044c\u044e 1\/x1 \u0438 E2 \u0441 \u0435\u0434\u0438\u043d\u0438\u0447\u043d\u043e\u0439 \u043f\u043b\u043e\u0442\u043d\u043e\u0441\u0442\u044c\u044e.<\/li>\n<li>\u0415\u0441\u043b\u0438 E2 &gt; E1^2 \/ 2, \u0442\u043e \u043f\u0440\u0438\u043d\u0438\u043c\u0430\u0435\u043c |X| = E1 + x1, \u0438\u043d\u0430\u0447\u0435 \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u043c\u0441\u044f \u043d\u0430\u0437\u0430\u0434.<\/li>\n<li> \u0413\u0435\u043d\u0435\u0440\u0438\u0440\u0443\u0435\u043c U. \u0415\u0441\u043b\u0438 U &lt; 0.5, \u0442\u043e \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u043c -|X|, \u0438\u043b\u0438 \u0436\u0435 |X| \u0432 \u0434\u0440\u0443\u0433\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435.<\/li>\n<\/ol>\n<p>  \u0422\u043e\u0433\u0434\u0430 \u043f\u043e\u043b\u043d\u043e\u0441\u0442\u044c\u044e \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c \u0431\u0443\u0434\u0435\u0442 \u0432\u044b\u0433\u043b\u044f\u0434\u0435\u0442\u044c \u0442\u0430\u043a:<\/p>\n<ol>\n<li>\u0421\u043b\u0443\u0447\u0430\u0439\u043d\u043e \u0438 \u0440\u0430\u0432\u043d\u043e\u043c\u0435\u0440\u043d\u043e \u0432\u044b\u0431\u0438\u0440\u0430\u0435\u0442\u0441\u044f \u043f\u0440\u044f\u043c\u043e\u0443\u0433\u043e\u043b\u044c\u043d\u0438\u043a i \u0438 \u0433\u0435\u043d\u0435\u0440\u0438\u0440\u0443\u0435\u0442\u0441\u044f \u0440\u0430\u0432\u043d\u043e\u043c\u0435\u0440\u043d\u043e \u0440\u0430\u0441\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u043d\u0430\u044f \u0432\u0435\u043b\u0438\u0447\u0438\u043d\u0430 X \u043e\u0442 0 \u0434\u043e x_i.<\/li>\n<li>\u0415\u0441\u043b\u0438 X &lt; x_{i+1}, \u0442\u043e \u043c\u044b \u0442\u043e\u0447\u043d\u043e \u043f\u043e\u043f\u0430\u043b\u0438 \u043f\u043e\u0434 \u043a\u0440\u0438\u0432\u0443\u044e \u2014 \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u043c X.<\/li>\n<li>\u0415\u0441\u043b\u0438 \u043f\u043e\u043f\u0430\u043b\u0438 \u0432 \u0431\u0430\u0437\u043e\u0432\u044b\u0439 \u0441\u043b\u043e\u0439, \u0442\u043e \u0435\u0441\u0442\u044c i = 0, \u0442\u043e \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u0435\u043c \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c \u0434\u043b\u044f \u0445\u0432\u043e\u0441\u0442\u0430 \u0438 \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u043c \u0435\u0433\u043e \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442.<\/li>\n<li>\u0413\u0435\u043d\u0435\u0440\u0438\u0440\u0443\u0435\u043c \u043d\u043e\u0432\u0443\u044e \u0440\u0430\u0432\u043d\u043e\u043c\u0435\u0440\u043d\u043e \u0440\u0430\u0441\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u043d\u0443\u044e \u0432\u0435\u043b\u0438\u0447\u0438\u043d\u0443 Y \u043e\u0442 y_i \u0434\u043e y _{i + 1}. \u0415\u0441\u043b\u0438 \u0442\u043e\u0447\u043a\u0430 \u0441 \u043a\u043e\u043e\u0440\u0434\u0438\u043d\u0430\u0442\u0430\u043c\u0438 (X, Y) \u043b\u0435\u0436\u0438\u0442 \u043f\u043e\u0434 \u043a\u0440\u0438\u0432\u043e\u0439, \u0442\u043e \u0435\u0441\u0442\u044c Y &lt; f(X) \u2014 \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u043c X. \u0418\u043d\u0430\u0447\u0435 \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u043c\u0441\u044f \u043d\u0430 \u043f\u0435\u0440\u0432\u044b\u0439 \u0448\u0430\u0433.<\/li>\n<\/ol>\n<p>  \u0412\u043e\u043f\u0440\u043e\u0441 \u0432 \u0442\u043e\u043c, \u043a\u0430\u043a \u043d\u0430\u0439\u0442\u0438 \u043a\u043e\u043d\u0441\u0442\u0430\u043d\u0442\u044b \u0410 \u0438 x1 \u0432 \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0438 \u043e\u0442 \u0447\u0438\u0441\u043b\u0430 \u043f\u0440\u044f\u043c\u043e\u0443\u0433\u043e\u043b\u044c\u043d\u0438\u043a\u043e\u0432? \u041c\u043e\u0436\u043d\u043e \u0438\u0445 \u043d\u0430\u0439\u0442\u0438 \u043e\u0431\u044b\u043a\u043d\u043e\u0432\u0435\u043d\u043d\u044b\u043c \u0447\u0438\u0441\u043b\u0435\u043d\u043d\u044b\u043c \u043c\u0435\u0442\u043e\u0434\u043e\u043c. \u0411\u0435\u0440\u0435\u043c \u043d\u0430\u0447\u0430\u043b\u044c\u043d\u043e\u0435 \u043f\u0440\u0435\u0434\u043f\u043e\u043b\u043e\u0436\u0435\u043d\u0438\u0435 x1, \u0441\u0442\u0440\u043e\u0438\u043c \u0431\u0430\u0437\u043e\u0432\u044b\u0439 \u0441\u043b\u043e\u0439, \u0432\u044b\u0447\u0438\u0441\u043b\u044f\u0435\u043c \u0410 \u0438 \u0441\u0442\u0440\u043e\u0438\u043c \u0437\u0438\u043a\u043a\u0443\u0440\u0430\u0442 \u043f\u043e\u043a\u0430 \u043d\u0435 \u043f\u043e\u0441\u0442\u0440\u043e\u0438\u043b\u0438 \u043d\u0443\u0436\u043d\u043e\u0435 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u043f\u0440\u044f\u043c\u043e\u0443\u0433\u043e\u043b\u044c\u043d\u0438\u043a\u043e\u0432. \u0415\u0441\u043b\u0438 \u043c\u044b \u043e\u043a\u0430\u0437\u0430\u043b\u0438\u0441\u044c \u0432\u044b\u0448\u0435 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u2014 \u0437\u043d\u0430\u0447\u0438\u0442 \u043c\u044b \u0432\u0437\u044f\u043b\u0438 \u0441\u043b\u0438\u0448\u043a\u043e\u043c \u043c\u0430\u043b\u0435\u043d\u044c\u043a\u043e\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 x1 \u0438 \u0441\u043b\u0438\u0448\u043a\u043e\u043c \u0431\u043e\u043b\u044c\u0448\u043e\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u0410 \u2014 \u043f\u044b\u0442\u0430\u0435\u043c\u0441\u044f \u043f\u043e\u0441\u0442\u0440\u043e\u0438\u0442\u044c \u0441 \u043d\u043e\u0432\u044b\u043c\u0438 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f\u043c\u0438 \u0437\u0430\u043d\u043e\u0432\u043e. <\/p>\n<p>  \u0421\u0430\u043c \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c \u043c\u043e\u0436\u043d\u043e \u0443\u0441\u043a\u043e\u0440\u0438\u0442\u044c \u0440\u0430\u0437\u043b\u0438\u0447\u043d\u044b\u043c\u0438 \u0445\u0438\u0442\u0440\u043e\u0441\u0442\u044f\u043c\u0438 \u0440\u0430\u0431\u043e\u0442\u044b \u0441 32-\u0431\u0438\u0442\u043d\u044b\u043c\u0438 \u0446\u0435\u043b\u044b\u043c\u0438, \u0443\u0431\u0438\u0440\u0430\u044f \u043d\u0435\u043d\u0443\u0436\u043d\u044b\u0435 \u043f\u0435\u0440\u0435\u043c\u043d\u043e\u0436\u0435\u043d\u0438\u044f. \u0414\u043b\u044f \u0431\u043e\u043b\u044c\u0448\u0435\u0439 \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u0438 \u043c\u043e\u0436\u043d\u043e \u043e\u0431\u0440\u0430\u0442\u0438\u0442\u044c\u0441\u044f \u043a \u0441\u0442\u0430\u0442\u044c\u0435 George Marsaglia and Wai Wan Tsang \u00abThe Ziggurat Method for Generating Random Variables\u00bb. \u0417\u0434\u0435\u0441\u044c \u044f \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u044f\u044e \u043d\u0435 \u0434\u043e \u043a\u043e\u043d\u0446\u0430 \u043e\u043f\u0442\u0438\u043c\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0439, \u043d\u043e \u0437\u0430\u0442\u043e \u043f\u043e\u043d\u044f\u0442\u043d\u044b\u0439 \u043a\u043e\u0434 (\u0441 \u0443\u0447\u0435\u0442\u043e\u043c, \u0447\u0442\u043e \u043c\u044b \u0443\u043c\u0435\u0435\u043c \u0433\u0435\u043d\u0435\u0440\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u044d\u043a\u0441\u043f\u043e\u043d\u0435\u043d\u0446\u0438\u0430\u043b\u044c\u043d\u043e\u0435 \u0440\u0430\u0441\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u0435).<\/p>\n<pre><code>static double stairWidth[257], stairHeight[256]; const double x1 = 3.6541528853610088; const double A = 4.92867323399e-3; \/\/\/ area under rectangle  void setupNormalTables() {     \/\/ coordinates of the implicit rectangle in base layer     stairHeight[0] = exp(-.5 * x1 * x1);     stairWidth[0] = A \/ stairHeight[0];     \/\/ implicit value for the top layer     stairWidth[256] = 0;     for (unsigned i = 1; i &lt;= 255; ++i)     {         \/\/ such y_i that f(x_{i+1}) = y_i         stairWidth[i] = std::sqrt(-2 * log(stairHeight[i - 1]));         stairHeight[i] = stairHeight[i - 1] + A \/ stairWidth[i];     } }  double NormalZiggurat() {     int iter = 0;     do {         unsigned long B = BasicRandGenerator();         unsigned long stairId = B & 255;         double x = UniformRand() * stairWidth[stairId]; \/\/ get horizontal coordinate         if (x &lt; stairWidth[stairId + 1])             return ((signed)B &gt; 0) ? x : -x;         if (stairId == 0) \/\/ handle the base layer         {             static double z = -1;             if (z &gt;= 0) \/\/ we don't have to generate another exponential variable as we already have one             {                 x = Exponential(x1);                 z -= 0.5 * x * x;             }             if (z &lt; 0) \/\/ if previous generation wasn't successful             {                 double y;                 do {                     x = Exponential(x1);                     y = Exponential(1);                     z = y - 0.5 * x * x; \/\/ we storage this value as after acceptance it becomes exponentially distributed                 } while (z &lt;= 0);             }             x += x1;             return ((signed)B &gt; 0) ? x : -x;         }         \/\/ handle the wedges of other stairs         if (Uniform(stairHeight[stairId - 1], stairHeight[stairId]) &lt; exp(-.5 * x * x))             return ((signed)B &gt; 0) ? x : -x;     } while (++iter &lt;= 1e9); \/\/\/ one billion should be enough     return 0; \/\/\/ fail due to some error }  double Normal(double mu, double sigma) {     return mu + NormalZiggurat() * sigma; } <\/code><\/pre>\n<h4>\u042d\u043a\u0441\u043f\u043e\u043d\u0435\u043d\u0446\u0438\u0430\u043b\u044c\u043d\u043e\u0435 \u0440\u0430\u0441\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u0435<\/h4>\n<p>  <\/p>\n<div style=\"text-align:center;\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/files\/5b8\/8e6\/80d\/5b88e680db99481eab2ddd004b75ee6b.png\" \/><\/div>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/files\/0d7\/10e\/5ea\/0d710e5ea51740d886659b770ec6e17d.png\"\/><\/p>\n<p>  \u0423\u0436\u0435 \u0433\u043e\u0432\u043e\u0440\u0438\u043b\u043e\u0441\u044c, \u0447\u0442\u043e \u0434\u043b\u044f \u044d\u043a\u0441\u043f\u043e\u043d\u0435\u043d\u0446\u0438\u0430\u043b\u044c\u043d\u043e\u0433\u043e \u0440\u0430\u0441\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u044f \u043c\u043e\u0436\u043d\u043e \u0432\u0437\u044f\u0442\u044c \u043b\u043e\u0433\u0430\u0440\u0438\u0444\u043c \u043e\u0442 \u0440\u0430\u0432\u043d\u043e\u043c\u0435\u0440\u043d\u043e \u0440\u0430\u0441\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u043d\u043e\u0439 \u0432\u0435\u043b\u0438\u0447\u0438\u043d\u044b \u0438 \u0447\u0442\u043e \u043c\u043e\u0436\u043d\u043e \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u0433\u0435\u043d\u0435\u0440\u0430\u0446\u0438\u044e \u0431\u044b\u0441\u0442\u0440\u0435\u0435. \u0422\u0430\u043a \u043a\u0430\u043a \u043b\u044e\u0431\u0430\u044f \u044d\u043a\u0441\u043f\u043e\u043d\u0435\u043d\u0446\u0438\u0430\u043b\u044c\u043d\u0430\u044f \u0432\u0435\u043b\u0438\u0447\u0438\u043d\u0430 \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u0442\u0441\u044f \u0438\u0437 \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u043e\u0439 \u0434\u0435\u043b\u0435\u043d\u0438\u0435\u043c \u043d\u0430 \u043f\u043b\u043e\u0442\u043d\u043e\u0441\u0442\u044c, \u0433\u0435\u043d\u0435\u0440\u0430\u0446\u0438\u044e \u043c\u043e\u0436\u043d\u043e \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u043f\u0440\u0435\u0441\u043b\u043e\u0432\u0443\u0442\u044b\u043c Ziggurat. \u0412 \u0441\u043b\u0443\u0447\u0430\u0435 \u043f\u043e\u043f\u0430\u0434\u0430\u043d\u0438\u044f \u0432 \u0445\u0432\u043e\u0441\u0442 \u043c\u043e\u0436\u043d\u043e \u0437\u0430\u043f\u0443\u0441\u0442\u0438\u0442\u044c \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c \u043f\u043e \u043d\u043e\u0432\u043e\u0439 \u0438 \u043f\u0440\u0438\u0431\u0430\u0432\u0438\u0442\u044c \u043a \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u043d\u043e\u0439 \u0432\u0435\u043b\u0438\u0447\u0438\u043d\u0435 x1:<\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">\u0414\u043e\u043a\u0430\u0437\u0430\u0442\u0435\u043b\u044c\u0441\u0442\u0432\u043e<\/b><\/p>\n<div class=\"spoiler_text\">\u041d\u0443\u0436\u043d\u043e \u0434\u043e\u043a\u0430\u0437\u0430\u0442\u044c, \u0447\u0442\u043e \u043f\u0440\u0438 \u0415 &gt; x1 \u0444\u0443\u043d\u043a\u0446\u0438\u044f \u0440\u0430\u0441\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u044f E \u2014 x1 \u0431\u0443\u0434\u0435\u0442 \u0442\u0430\u043a\u0436\u0435 \u0440\u0430\u0441\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0430 \u044d\u043a\u0441\u043f\u043e\u043d\u0435\u043d\u0446\u0438\u0430\u043b\u044c\u043d\u043e. \u042d\u0442\u043e \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e \u0431\u043b\u0430\u0433\u043e\u0434\u0430\u0440\u044f \u0440\u0430\u043d\u0435\u0435 \u0443\u043f\u043e\u043c\u044f\u043d\u0443\u0442\u043e\u043c\u0443 \u043e\u0442\u0441\u0443\u0442\u0441\u0442\u0432\u0438\u044e \u043f\u0430\u043c\u044f\u0442\u0438 \u0443 \u044d\u043a\u0441\u043f\u043e\u043d\u0435\u043d\u0446\u0438\u0430\u043b\u044c\u043d\u043e\u0433\u043e \u0440\u0430\u0441\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u044f:<\/p>\n<div style=\"text-align:center;\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/files\/654\/82c\/950\/65482c95049748c3aa8cef7e1932a35b.png\" \/><\/div>\n<p>  <\/div>\n<\/div>\n<p>  \u0415\u0449\u0435 \u043f\u0430\u0440\u0430 \u0444\u0430\u043a\u0442\u043e\u0432: \u0435\u0441\u043b\u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0442\u0430\u0431\u043b\u0438\u0446\u0443 \u0441 255 \u043f\u0440\u044f\u043c\u043e\u0443\u0433\u043e\u043b\u044c\u043d\u0438\u043a\u0430\u043c\u0438, \u0442\u043e \u0432\u0435\u0440\u043e\u044f\u0442\u043d\u043e\u0441\u0442\u044c \u043f\u0440\u0438\u043d\u044f\u0442\u0438\u044f \u0441 \u043f\u0435\u0440\u0432\u043e\u0433\u043e \u0440\u0430\u0437\u0430 \u0434\u043b\u044f \u044d\u043a\u0441\u043f\u043e\u043d\u0435\u043d\u0446\u0438\u0430\u043b\u044c\u043d\u043e\u0433\u043e \u0440\u0430\u0441\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u044f \u2014 0.989, \u0434\u043b\u044f \u043d\u043e\u0440\u043c\u0430\u043b\u044c\u043d\u043e\u0433\u043e \u2014 0.993. \u0412 MATLAB \u0441 5 \u0432\u0435\u0440\u0441\u0438\u0438 \u0434\u043b\u044f \u043d\u043e\u0440\u043c\u0430\u043b\u044c\u043d\u043e\u0433\u043e \u0440\u0430\u0441\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u044f \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f Ziggurat (\u0440\u0430\u043d\u044c\u0448\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043b\u0441\u044f \u043f\u043e\u043b\u044f\u0440\u043d\u044b\u0439 \u043c\u0435\u0442\u043e\u0434). \u0412 R \u0434\u043b\u044f \u043d\u043e\u0440\u043c\u0430\u043b\u044c\u043d\u044b\u0445 \u0432\u0435\u043b\u0438\u0447\u0438\u043d, \u043d\u0430\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u043c\u043d\u0435 \u0438\u0437\u0432\u0435\u0441\u0442\u043d\u043e, \u0430\u043f\u043f\u0440\u043e\u043a\u0441\u0438\u043c\u0438\u0440\u0443\u044e\u0442 \u043f\u043e\u043b\u0438\u043d\u043e\u043c\u0430\u043c\u0438 \u043e\u0431\u0440\u0430\u0442\u043d\u0443\u044e \u0444\u0443\u043d\u043a\u0446\u0438\u044e \u043e\u0448\u0438\u0431\u043e\u043a \u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e\u0442 \u043c\u0435\u0442\u043e\u0434 \u0438\u043d\u0432\u0435\u0440\u0441\u0438\u0438.<\/p>\n<pre><code>static double stairWidth[257], stairHeight[256]; const double x1 = 7.69711747013104972; const double A = 3.9496598225815571993e-3; \/\/\/ area under rectangle  void setupExpTables() {     \/\/ coordinates of the implicit rectangle in base layer     stairHeight[0] = exp(-x1);     stairWidth[0] = A \/ stairHeight[0];     \/\/ implicit value for the top layer     stairWidth[256] = 0;     for (unsigned i = 1; i &lt;= 255; ++i)     {         \/\/ such y_i that f(x_{i+1}) = y_i         stairWidth[i] = -log(stairHeight[i - 1]);         stairHeight[i] = stairHeight[i - 1] + A \/ stairWidth[i];     } }  double ExpZiggurat() {     int iter = 0;     do {         unsigned long stairId = BasicRandGenerator() & 255;         double x = Uniform(0, stairWidth[stairId]); \/\/ get horizontal coordinate         if (x &lt; stairWidth[stairId + 1]) \/\/\/ if we are under the upper stair - accept             return x;         if (stairId == 0) \/\/ if we catch the tail             return x1 + standardVariate();         if (Uniform(stairHeight[stairId - 1], stairHeight[stairId]) &lt; exp(-x)) \/\/ if we are under the curve - accept             return x;         \/\/ rejection - go back     } while (++iter &lt;= 1e9); \/\/ one billion should be enough to be sure there is a bug     return 0; \/\/ fail due to some error }  double Exponential(double rate) {     return ExpZiggurat() \/ rate; } <\/code><\/pre>\n<h4>\u0413\u0430\u043c\u043c\u0430 \u0440\u0430\u0441\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u0435<\/h4>\n<p>  <\/p>\n<div style=\"text-align:center;\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/files\/42a\/771\/a70\/42a771a70a5e483ab100b659e7a9b769.png\" \/><\/div>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/files\/740\/290\/742\/74029074278e4b5daa7c048c9f8da5b0.png\"\/><\/p>\n<p>  \u0410\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u044b \u0434\u043b\u044f \u0433\u0435\u043d\u0435\u0440\u0430\u0446\u0438\u0438 \u0437\u0434\u0435\u0441\u044c \u0443\u0436\u0435 \u0441\u043b\u043e\u0436\u043d\u0435\u0435, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u044f \u043d\u0435 \u0431\u0443\u0434\u0443 \u0437\u0434\u0435\u0441\u044c \u043e\u043f\u0438\u0441\u044b\u0432\u0430\u0442\u044c \u0438\u0445 \u0434\u043e\u043a\u0430\u0437\u0430\u0442\u0435\u043b\u044c\u0441\u0442\u0432\u0430, \u043f\u0440\u0438\u0432\u043e\u0436\u0443 \u043b\u0438\u0448\u044c \u043f\u0440\u0438\u043c\u0435\u0440\u044b. \u0414\u043b\u044f \u0433\u0435\u043d\u0435\u0440\u0430\u0446\u0438\u0438 \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u043e\u0439 \u0432\u0435\u043b\u0438\u0447\u0438\u043d\u044b (theta = 1), \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e\u0442\u0441\u044f \u0447\u0435\u0442\u044b\u0440\u0435 \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u0430, \u043a\u0430\u0436\u0434\u044b\u0439 \u0432 \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0438 \u043e\u0442 k.  <\/p>\n<ul>\n<li>\u0415\u0441\u043b\u0438 k \u0438\u043b\u0438 2k \u2014 \u0446\u0435\u043b\u043e\u0435 \u2014 GA \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c. <\/li>\n<li>\u0415\u0441\u043b\u0438 k &lt; 1 \u2014 GS \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c. <\/li>\n<li>\u0415\u0441\u043b\u0438 1 &lt; k &lt; 3 \u2014 GF \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c.<\/li>\n<li>\u0415\u0441\u043b\u0438 k &gt; 3 \u2014 GO \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c. <\/li>\n<\/ul>\n<p>  \u041d\u0435\u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u0430\u044f \u0441\u043b\u0443\u0447\u0430\u0439\u043d\u0430\u044f \u0432\u0435\u043b\u0438\u0447\u0438\u043d\u0430 \u0441 \u0433\u0430\u043c\u043c\u0430-\u0440\u0430\u0441\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u0435\u043c, \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u0442\u0441\u044f \u0438\u0437 \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u043e\u0439 \u0443\u043c\u043d\u043e\u0436\u0435\u043d\u0438\u0435\u043c \u043d\u0430 theta.<\/p>\n<h5>\u0410\u043b\u0433\u043e\u0440\u0438\u0442\u043c GA<\/h5>\n<p>  \u0415\u0441\u043b\u0438 \u0441\u043b\u043e\u0436\u0438\u0442\u044c \u0434\u0432\u0435 \u0441\u043b\u0443\u0447\u0430\u0439\u043d\u044b\u0435 \u0432\u0435\u043b\u0438\u0447\u0438\u043d\u044b \u0441 \u0433\u0430\u043c\u043c\u0430-\u0440\u0430\u0441\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u0435\u043c \u0441 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u0430\u043c\u0438 k1 \u0438 k2, \u0442\u043e \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u0441\u044f \u0441\u043b\u0443\u0447\u0430\u0439\u043d\u0430\u044f \u0432\u0435\u043b\u0438\u0447\u0438\u043d\u0430 \u0441 \u0433\u0430\u043c\u043c\u0430-\u0440\u0430\u0441\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u0435\u043c \u0438 \u0441 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u043e\u043c k1+k2. \u0415\u0449\u0435 \u043e\u0434\u043d\u043e \u0441\u0432\u043e\u0439\u0441\u0442\u0432\u043e \u2014 \u0435\u0441\u043b\u0438 theta = k = 1, \u0442\u043e \u043b\u0435\u0433\u043a\u043e \u043f\u0440\u043e\u0432\u0435\u0440\u0438\u0442\u044c, \u0447\u0442\u043e \u0440\u0430\u0441\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u0435 \u0431\u0443\u0434\u0435\u0442 \u044d\u043a\u0441\u043f\u043e\u043d\u0435\u043d\u0446\u0438\u0430\u043b\u044c\u043d\u044b\u043c. \u041f\u043e\u044d\u0442\u043e\u043c\u0443, \u0435\u0441\u043b\u0438 k \u0446\u0435\u043b\u043e\u0435 \u2014 \u0442\u043e \u043c\u043e\u0436\u043d\u043e \u043f\u0440\u043e\u0441\u0442\u043e \u043f\u0440\u043e\u0441\u0443\u043c\u043c\u0438\u0440\u043e\u0432\u0430\u0442\u044c k \u0441\u043b\u0443\u0447\u0430\u0439\u043d\u044b\u0445 \u0432\u0435\u043b\u0438\u0447\u0438\u043d \u0441\u043e \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u044b\u043c \u044d\u043a\u0441\u043f\u043e\u043d\u0435\u043d\u0446\u0438\u0430\u043b\u044c\u043d\u044b\u043c \u0440\u0430\u0441\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u0435\u043c.<\/p>\n<pre><code>double GA1(int k) {     double x = 0;     for (int i = 0; i &lt; k; ++i)         x += Exponential(1);     return x; } <\/code><\/pre>\n<p>   \u0415\u0441\u043b\u0438 k \u043d\u0435 \u0446\u0435\u043b\u043e\u0435, \u043d\u043e 2k \u2014 \u0446\u0435\u043b\u043e\u0435, \u0442\u043e \u043c\u043e\u0436\u043d\u043e \u0432\u043c\u0435\u0441\u0442\u043e \u043e\u0434\u043d\u043e\u0439 \u0438\u0437 \u044d\u043a\u0441\u043f\u043e\u043d\u0435\u043d\u0446\u0438\u0430\u043b\u044c\u043d\u044b\u0445 \u0441\u043b\u0443\u0447\u0430\u0439\u043d\u044b\u0445 \u0432\u0435\u043b\u0438\u0447\u0438\u043d \u0432 \u0441\u0443\u043c\u043c\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u043f\u043e\u043b\u043e\u0432\u0438\u043d\u0443 \u043a\u0432\u0430\u0434\u0440\u0430\u0442\u0430 \u043d\u043e\u0440\u043c\u0430\u043b\u044c\u043d\u043e\u0439 \u0432\u0435\u043b\u0438\u0447\u0438\u043d\u044b. \u041f\u043e\u0447\u0435\u043c\u0443 \u0442\u0430\u043a \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e, \u0441\u0442\u0430\u043d\u0435\u0442 \u044f\u0441\u043d\u043e \u043f\u043e\u0437\u0434\u043d\u0435\u0435.<\/p>\n<pre><code>double GA2(double k) {     double x = Normal(0, 1);     x *= 0.5 * x;     for (int i = 1; i &lt; k; ++i)         x += Exponential(1);     return x; } <\/code><\/pre>\n<h5>\u0410\u043b\u0433\u043e\u0440\u0438\u0442\u043c GS<\/h5>\n<p>  <\/p>\n<ol>\n<li>\u0413\u0435\u043d\u0435\u0440\u0438\u0440\u0443\u0435\u043c \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u0443\u044e \u044d\u043a\u0441\u043f\u043e\u043d\u0435\u043d\u0446\u0438\u0430\u043b\u044c\u043d\u043e \u0440\u0430\u0441\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u043d\u0443\u044e \u0432\u0435\u043b\u0438\u0447\u0438\u043d\u0443 \u0415 \u0438 \u0432\u0435\u043b\u0438\u0447\u0438\u043d\u0443 U, \u0440\u0430\u0432\u043d\u043e\u043c\u0435\u0440\u043d\u043e \u0440\u0430\u0441\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u043d\u0443\u044e \u043e\u0442 0 \u0434\u043e 1 + k \/ e. \u0415\u0441\u043b\u0438 U &lt;= 1, \u0442\u043e \u043f\u0435\u0440\u0435\u0445\u043e\u0434\u0438\u043c \u043a \u0448\u0430\u0433\u0443 2. \u0418\u043d\u0430\u0447\u0435, \u043a \u0448\u0430\u0433\u0443 3.<\/li>\n<li>\u0417\u0430\u0434\u0430\u0435\u043c x = U^(1\/k). \u0415\u0441\u043b\u0438 x &lt;= E, \u0442\u043e \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u043c x, \u0438\u043d\u0430\u0447\u0435 \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u043c\u0441\u044f \u043d\u0430\u0437\u0430\u0434 \u043d\u0430 \u0448\u0430\u0433 1.<\/li>\n<li>\u0417\u0430\u0434\u0430\u0435\u043c x = -ln((1 \u2014 U) \/ k + 1 \/ e). \u0415\u0441\u043b\u0438 (1 \u2014 k) * ln(x) &lt;= E, \u0442\u043e \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u043c x, \u0438\u043d\u0430\u0447\u0435 \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u043c\u0441\u044f \u043d\u0430 \u0448\u0430\u0433 1.<\/li>\n<\/ol>\n<p>  <\/p>\n<pre><code>double GS(double k) {     \/\/ Assume that k &lt; 1     double x = 0;     int iter = 0;     do {         \/\/ M_E is base of natural logarithm         double U = Uniform(0, 1 + k \/ M_E)         double E = Exponential(1)         if (U &lt;= 1)         {             x = pow(U, 1.0 \/ k);             if (x &lt;= E)                 return x;         }         else         {             x = -log((1 - U) \/ k + 1.0 \/ M_E);             if ((1 - k) * log(x) &lt;= E)                 return x;         }     } while (++iter &lt; 1e9); \/\/ excessive maximum number of rejections     return 0; \/\/ shouldn't end up here } <\/code><\/pre>\n<h5>\u0410\u043b\u0433\u043e\u0440\u0438\u0442\u043c GF<\/h5>\n<p>  \u041d\u0430\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u043c\u043d\u0435 \u0438\u0437\u0432\u0435\u0441\u0442\u043d\u043e, \u0430\u0432\u0442\u043e\u0440 \u044d\u0442\u043e\u0433\u043e \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u0430, \u043f\u0440\u043e\u0444\u0435\u0441\u0441\u043e\u0440 \u0423\u043d\u0438\u0432\u0435\u0440\u0441\u0438\u0442\u0435\u0442\u0430 \u0421\u0435\u0432\u0435\u0440\u043d\u043e\u0439 \u041a\u0430\u0440\u043e\u043b\u0438\u043d\u044b \u0414\u0436. \u0421. \u0424\u0438\u0448\u043c\u0430\u043d, \u043d\u0435 \u0441\u0442\u0430\u043b \u043e\u043f\u0443\u0431\u043b\u0438\u043a\u043e\u0432\u044b\u0432\u0430\u0442\u044c \u0441\u0432\u043e\u0435 \u0434\u043e\u0441\u0442\u0438\u0436\u0435\u043d\u0438\u0435. \u0421\u0430\u043c \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u0434\u043b\u044f k &gt; 1, \u043e\u0434\u043d\u0430\u043a\u043e \u0441\u0440\u0435\u0434\u043d\u0435\u0435 \u0432\u0440\u0435\u043c\u044f \u0435\u0433\u043e \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f \u0443\u0431\u044b\u0432\u0430\u0435\u0442 \u043f\u0440\u043e\u043f\u043e\u0440\u0446\u0438\u043e\u043d\u0430\u043b\u044c\u043d\u043e sqrt(k), \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u043e\u043d \u044d\u0444\u0444\u0435\u043a\u0442\u0438\u0432\u0435\u043d \u0442\u043e\u043b\u044c\u043a\u043e \u0434\u043b\u044f k &lt; 3. \u0410\u043b\u0433\u043e\u0440\u0438\u0442\u043c:  <\/p>\n<ol>\n<li>\u0413\u0435\u043d\u0435\u0440\u0438\u0440\u0443\u0435\u043c \u0434\u0432\u0435 \u043d\u0435\u0437\u0430\u0432\u0438\u0441\u0438\u043c\u044b\u0445 \u0441\u043b\u0443\u0447\u0430\u0439\u043d\u044b\u0445 \u0432\u0435\u043b\u0438\u0447\u0438\u043d\u044b E1 \u0438 E2 \u0441\u043e \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u044b\u043c \u044d\u043a\u0441\u043f\u043e\u043d\u0435\u043d\u0446\u0438\u0430\u043b\u044c\u043d\u044b\u043c \u0440\u0430\u0441\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u0435\u043c.<\/li>\n<li>\u0415\u0441\u043b\u0438 E2 &lt; (k \u2014 1) * (E1 \u2014 ln(E1) \u2014 1), \u0442\u043e \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u043c\u0441\u044f \u043d\u0430\u0437\u0430\u0434 \u043d\u0430 \u0448\u0430\u0433 1.<\/li>\n<li>\u0412\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u043c x = k * E1<\/li>\n<\/ol>\n<p>  <\/p>\n<pre><code>double GF(double k) {     \/\/ Assume that 1 &lt; k &lt; 3     double E1, E2;     do {         E1 = Exponential(1);         E2 = Exponential(1);     } while (E2 &lt; (k - 1) * (E1 - log(E1) - 1));     return k * E1; } <\/code><\/pre>\n<h5>\u0410\u043b\u0433\u043e\u0440\u0438\u0442\u043c GO<\/h5>\n<p>  \u0410\u043b\u0433\u043e\u0440\u0438\u0442\u043c \u0414\u0438\u0442\u0435\u0440\u0430 \u0438 \u0410\u0440\u0435\u043d\u0441\u0430 \u043e\u0441\u043d\u043e\u0432\u0430\u043d \u043d\u0430 \u0430\u0441\u0438\u043c\u043f\u0442\u043e\u0442\u0438\u0447\u0435\u0441\u043a\u043e\u0439 \u043d\u043e\u0440\u043c\u0430\u043b\u044c\u043d\u043e\u0441\u0442\u0438 \u0440\u0430\u0441\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u044f \u043f\u0440\u0438 \u0443\u0432\u0435\u043b\u0438\u0447\u0435\u043d\u0438\u0438 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u0430, \u0438 \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u0431\u043e\u043b\u0435\u0435 \u0431\u044b\u0441\u0442\u0440 \u0434\u043b\u044f \u0431\u043e\u043b\u044c\u0448\u0438\u0445 k. \u041e\u043d \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u0434\u043b\u044f k &gt; 2.533, \u043e\u0434\u043d\u0430\u043a\u043e \u043d\u0435 \u0441\u0442\u043e\u043b\u044c \u044d\u0444\u0444\u0435\u043a\u0442\u0438\u0432\u0435\u043d \u043a\u0430\u043a \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c \u0424\u0438\u0448\u0435\u0440\u0430 \u0434\u043b\u044f k &lt; 3. \u0414\u043b\u044f \u043d\u0430\u0447\u0430\u043b\u0430 \u043d\u0443\u0436\u043d\u043e \u0437\u0430\u0434\u0430\u0442\u044c \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043a\u043e\u043d\u0441\u0442\u0430\u043d\u0442\u044b (\u0437\u0430\u0432\u0438\u0441\u044f\u0449\u0438\u0435 \u0442\u043e\u043b\u044c\u043a\u043e \u043e\u0442 k).<\/p>\n<pre><code>void setupConstants(double k) {     m = k - 1;     s_2 = sqrt(8.0 * k \/ 3) + k;     s = sqrt(s_2);     d = M_SQRT2 * M_SQRT3 * s_2;     b = d + m;     w = s_2 \/ (m - 1);     v = (s_2 + s_2) \/ (m * sqrt(k));     c = b + log(s * d \/ b) - m - m - 3.7203285; }   double GO(double k) {     \/\/ Assume that k &gt; 3     double x = 0;     int iter = 0;     do {         double U = Uniform(0, 1);         if (U &lt;= 0.0095722652) {             double E1 = Exponential(1);             double E2 = Exponential(1);             x = b * (1 + E1 \/ d);             if (m * (x \/ b - log(x \/ m)) + c &lt;= E2)                 return x;         }         else {             double N;             do {                 N = Normal(0, 1);                 x = s * N + m; \/\/ ~ Normal(m, s)             } while (x &lt; 0 || x &gt; b);             U = Uniform(0, 1);             double S = 0.5 * N * N;             if (N &gt; 0) {                 if (U &lt; 1 - w * S)                     return x;             }             else if (U &lt; 1 + S * (v * N - w))                 return x;             if (log(U) &lt; m * log(x \/ m) + m - x + S)                 return x;         }     } while (++iter &lt; 1e9);     return 0; \/\/ shouldn't end up here; } <\/code><\/pre>\n<p>  \u041a\u0430\u043a \u0438 \u0432 \u0441\u043b\u0443\u0447\u0430\u0435 \u043f\u0440\u0435\u0434\u044b\u0434\u0443\u0449\u0438\u0445 \u0440\u0430\u0441\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u0439 \u2014 \u043b\u044e\u0431\u0430\u044f \u0432\u0435\u043b\u0438\u0447\u0438\u043d\u0430 \u0441 \u0433\u0430\u043c\u043c\u0430 \u0440\u0430\u0441\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u0435\u043c \u0433\u0435\u043d\u0435\u0440\u0438\u0440\u0443\u0435\u0442\u0441\u044f \u0438\u0437 \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u043e\u0439 \u0443\u043c\u043d\u043e\u0436\u0435\u043d\u0438\u0435\u043c \u043d\u0430 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440 theta. \u0423\u043c\u0435\u044f \u0433\u0435\u043d\u0435\u0440\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0440\u0430\u0432\u043d\u043e\u043c\u0435\u0440\u043d\u043e\u0435, \u043d\u043e\u0440\u043c\u0430\u043b\u044c\u043d\u043e\u0435, \u044d\u043a\u0441\u043f\u043e\u043d\u0435\u043d\u0446\u0438\u0430\u043b\u044c\u043d\u043e\u0435 \u0438 \u0433\u0430\u043c\u043c\u0430 \u0440\u0430\u0441\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u044f, \u0432\u044b, \u0441\u043a\u043e\u0440\u0435\u0435 \u0432\u0441\u0435\u0433\u043e, \u0441 \u043b\u0435\u0433\u043a\u043e\u0441\u0442\u044c\u044e \u0441\u043c\u043e\u0436\u0435\u0442\u0435 \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u0431\u043e\u043b\u044c\u0448\u0438\u043d\u0441\u0442\u0432\u043e \u0434\u0440\u0443\u0433\u0438\u0445 \u0440\u0430\u0441\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u0439, \u0431\u043b\u0430\u0433\u043e \u043e\u043d\u0438 \u043b\u0435\u0433\u043a\u043e \u0432\u044b\u0440\u0430\u0436\u0430\u044e\u0442\u0441\u044f \u0447\u0435\u0440\u0435\u0437 \u0432\u044b\u0448\u0435\u0443\u043f\u043e\u043c\u044f\u043d\u0443\u0442\u044b\u0435.<\/p>\n<h4>\u0420\u0430\u0441\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u0435 \u041a\u043e\u0448\u0438<\/h4>\n<p>  <\/p>\n<div style=\"text-align:center;\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/files\/534\/f41\/144\/534f41144b454f34a522b273a3e62c0a.png\" \/><\/div>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/files\/dd6\/1b4\/563\/dd61b45634cc4009b4c6a9036c018ff9.png\"\/><br \/>  \u041e\u0434\u0438\u043d \u0438\u0437 \u0441\u043f\u043e\u0441\u043e\u0431\u043e\u0432 \u0431\u044b\u0441\u0442\u0440\u043e \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u0441\u043b\u0443\u0447\u0430\u0439\u043d\u0443\u044e \u0432\u0435\u043b\u0438\u0447\u0438\u043d\u0443 \u0441 \u0440\u0430\u0441\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u0435\u043c \u041a\u043e\u0448\u0438 \u2014 \u044d\u0442\u043e \u0432\u0437\u044f\u0442\u044c \u0434\u0432\u0435 \u043d\u043e\u0440\u043c\u0430\u043b\u044c\u043d\u044b\u0435 \u0441\u043b\u0443\u0447\u0430\u0439\u043d\u044b\u0435 \u0432\u0435\u043b\u0438\u0447\u0438\u043d\u044b \u0438 \u043f\u043e\u0434\u0435\u043b\u0438\u0442\u044c \u0434\u0440\u0443\u0433 \u043d\u0430 \u0434\u0440\u0443\u0433\u0430. \u041c\u043e\u0436\u043d\u043e \u043b\u0438 \u0431\u044b\u0441\u0442\u0440\u0435\u0435? \u041c\u043e\u0436\u043d\u043e \u0432\u043e\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c\u0441\u044f \u043e\u0431\u044b\u0447\u043d\u044b\u043c \u043c\u0435\u0442\u043e\u0434\u043e\u043c \u0438\u043d\u0432\u0435\u0440\u0441\u0438\u0438, \u043d\u043e \u043e\u043d \u043f\u043e\u0442\u0440\u0435\u0431\u0443\u0435\u0442 \u0432\u044b\u0447\u0438\u0441\u043b\u0435\u043d\u0438\u044f \u0442\u0430\u043d\u0433\u0435\u043d\u0441\u0430. \u042d\u0442\u043e \u0435\u0449\u0435 \u043c\u0435\u0434\u043b\u0435\u043d\u043d\u0435\u0435. \u0418\u043b\u0438 \u043d\u0435\u0442?<br \/>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/files\/398\/991\/989\/3989919897a84d4db2b6b86ffb06dc96.png\" align=\"right\" height=\"140\"\/><br \/>  \u041f\u043e\u043c\u043d\u0438\u0442\u0435 \u043f\u043e\u043b\u044f\u0440\u043d\u044b\u0439 \u043c\u0435\u0442\u043e\u0434 \u0414\u0436\u043e\u0440\u0434\u0436\u0430 \u041c\u0430\u0440\u0441\u0430\u043b\u044c\u0438? \u041e\u043d \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u043b \u0432 \u043f\u0440\u0435\u043e\u0431\u0440\u0430\u0437\u043e\u0432\u0430\u043d\u0438\u0438 \u0411\u043e\u043a\u0441\u0430-\u041c\u044e\u043b\u043b\u0435\u0440\u0430 \u0431\u044b\u0441\u0442\u0440\u043e \u043f\u043e\u043b\u0443\u0447\u0430\u0442\u044c \u0441\u0438\u043d\u0443\u0441 \u0438\u043b\u0438 \u043a\u043e\u0441\u0438\u043d\u0443\u0441 \u0440\u0430\u0432\u043d\u043e\u043c\u0435\u0440\u043d\u043e \u0440\u0430\u0441\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u043d\u043e\u0439 \u0441\u043b\u0443\u0447\u0430\u0439\u043d\u043e\u0439 \u0432\u0435\u043b\u0438\u0447\u0438\u043d\u044b. \u0420\u043e\u0432\u043d\u043e \u0442\u0430\u043a\u0438\u043c \u0436\u0435 \u043e\u0431\u0440\u0430\u0437\u043e\u043c \u043c\u043e\u0436\u043d\u043e \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u0438 \u0442\u0430\u043d\u0433\u0435\u043d\u0441. \u0413\u0435\u043d\u0435\u0440\u0438\u0440\u0443\u0435\u043c \u0434\u0432\u0435 \u0440\u0430\u0432\u043d\u043e\u043c\u0435\u0440\u043d\u043e \u0440\u0430\u0441\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u043d\u044b\u0435 \u0441\u043b\u0443\u0447\u0430\u0439\u043d\u044b\u0435 \u043a\u043e\u043e\u0440\u0434\u0438\u043d\u0430\u0442\u044b x \u0438 y \u043d\u0430 \u043a\u0432\u0430\u0434\u0440\u0430\u0442\u0435 [-1, 1]x[-1, 1]. \u0415\u0441\u043b\u0438 \u043c\u044b \u043f\u043e\u043f\u0430\u043b\u0438 \u0432 \u043a\u0440\u0443\u0433 \u0441 \u0446\u0435\u043d\u0442\u0440\u043e\u043c \u0432 (0, 0) \u0438 \u0435\u0434\u0438\u043d\u0438\u0447\u043d\u044b\u043c \u0440\u0430\u0434\u0438\u0443\u0441\u043e\u043c \u2014 \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u043c x\/y, \u0438\u043d\u0430\u0447\u0435 \u2014 \u0433\u0435\u043d\u0435\u0440\u0438\u0440\u0443\u0435\u043c x \u0438 y \u0435\u0449\u0435 \u0440\u0430\u0437. \u0412\u0435\u0440\u043e\u044f\u0442\u043d\u043e\u0441\u0442\u044c \u043d\u0435 \u043f\u043e\u043f\u0430\u0441\u0442\u044c \u0432 \u043a\u0440\u0443\u0433, \u0441\u043a\u0430\u0436\u0435\u043c, \u0441 \u0440\u0430\u0437\u0430 \u0442\u0440\u0435\u0442\u044c\u0435\u0433\u043e \u0443\u0436\u0435 \u043c\u0435\u043d\u044c\u0448\u0435 \u0447\u0435\u043c 0.01.<\/p>\n<pre><code>double Cauchy(double x0, double gamma) {     double x, y;     do {         x = Uniform(-1,1);         y = Uniform(-1,1);     } while (x * x + y * y &gt; 1.0 || y == 0.0);     return x0 + gamma * x \/ y; } <\/code><\/pre>\n<h4>\u0420\u0430\u0441\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u0435 \u041b\u0430\u043f\u043b\u0430\u0441\u0430<\/h4>\n<p>  <\/p>\n<div style=\"text-align:center;\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/files\/492\/d26\/1ee\/492d261eeac04942ac6ee989dc9e13e1.png\" \/><\/div>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/files\/198\/f49\/29c\/198f4929c74a438c88edeeab124d78c4.png\"\/><br \/>  \u0420\u0430\u0441\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u0435 \u041b\u0430\u043f\u043b\u0430\u0441\u0430 \u2014 \u044d\u0442\u043e \u0442\u043e \u0436\u0435 \u044d\u043a\u0441\u043f\u043e\u043d\u0435\u043d\u0446\u0438\u0430\u043b\u044c\u043d\u043e\u0435, \u0442\u043e\u043b\u044c\u043a\u043e \u0441\u043e \u0441\u043b\u0443\u0447\u0430\u0439\u043d\u044b\u043c \u0437\u043d\u0430\u043a\u043e\u043c. <\/p>\n<pre><code>double Laplace(double mu, double b) {     double E = Exponential(1.0 \/ b);     return mu + (((signed)BasicRandGenerator() &gt; 0) ? E : -E); } <\/code><\/pre>\n<h4>\u0420\u0430\u0441\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u0435 \u041b\u0435\u0432\u0438<\/h4>\n<p>  <\/p>\n<div style=\"text-align:center;\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/files\/7ce\/b35\/45f\/7ceb3545f08f4706817be626042a39a2.png\" \/><\/div>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/files\/ee1\/545\/090\/ee15450903184b60bcaac1cccff3faa7.png\"\/><\/p>\n<p>  \u041d\u0435\u0441\u043c\u043e\u0442\u0440\u044f \u043d\u0430 \u0442\u043e, \u043a\u0430\u043a \u0443\u0436\u0430\u0441\u043d\u043e \u0432\u044b\u0433\u043b\u044f\u0434\u0438\u0442 \u0444\u0443\u043d\u043a\u0446\u0438\u044f \u043f\u043b\u043e\u0442\u043d\u043e\u0441\u0442\u0438 \u0440\u0430\u0441\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u044f, \u0441\u0430\u043c\u0430 \u0441\u043b\u0443\u0447\u0430\u0439\u043d\u0430\u044f \u0432\u0435\u043b\u0438\u0447\u0438\u043d\u0430 \u0433\u0435\u043d\u0435\u0440\u0438\u0440\u0443\u0435\u0442\u0441\u044f \u043a\u0440\u0430\u0439\u043d\u0435 \u043f\u0440\u043e\u0441\u0442\u043e \u0438 \u0431\u044b\u0441\u0442\u0440\u043e:<\/p>\n<pre><code>double Levy(double mu, double c) {     double N = Normal(mu, 1.0 \/ c);     return mu + 1.0 \/ (N * N); } <\/code><\/pre>\n<h4>\u0420\u0430\u0441\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u0435 \u0445\u0438-\u043a\u0432\u0430\u0434\u0440\u0430\u0442<\/h4>\n<p>  <\/p>\n<div style=\"text-align:center;\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/files\/5df\/251\/ae2\/5df251ae25474d25ac2f7e40a4e6ac71.png\" \/><\/div>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/files\/a05\/f2c\/036\/a05f2c0363d949ad986d9cc06cfe4325.png\"\/><br \/>  \u041a\u0430\u043a \u0438\u0437\u0432\u0435\u0441\u0442\u043d\u043e, \u0441\u043b\u0443\u0447\u0430\u0439\u043d\u0430\u044f \u0432\u0435\u043b\u0438\u0447\u0438\u043d\u0430 \u0441 \u0440\u0430\u0441\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u0435\u043c \u0445\u0438-\u043a\u0432\u0430\u0434\u0440\u0430\u0442 \u0441 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u043e\u043c k \u2014 \u044d\u0442\u043e \u0441\u0443\u043c\u043c\u0430 \u043a\u0432\u0430\u0434\u0440\u0430\u0442\u043e\u0432 k \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u044b\u0445 \u043d\u043e\u0440\u043c\u0430\u043b\u044c\u043d\u044b\u0445 \u0441\u043b\u0443\u0447\u0430\u0439\u043d\u044b\u0445 \u0432\u0435\u043b\u0438\u0447\u0438\u043d. \u041c\u0435\u043d\u0435\u0435 \u0438\u0437\u0432\u0435\u0441\u0442\u043d\u043e, \u0447\u0442\u043e \u043f\u0440\u0438 \u0447\u0435\u0442\u043d\u043e\u043c k \u044d\u0442\u043e \u0436\u0435 \u0438 \u0443\u0434\u0432\u043e\u0435\u043d\u043d\u0430\u044f \u0441\u0443\u043c\u043c\u0430 k\/2 \u044d\u043a\u0441\u043f\u043e\u043d\u0435\u043d\u0446\u0438\u0430\u043b\u044c\u043d\u044b\u0445 \u0441\u043b\u0443\u0447\u0430\u0439\u043d\u044b\u0445 \u0432\u0435\u043b\u0438\u0447\u0438\u043d (\u0438\u043b\u0438 \u0436\u0435 \u0440\u0430\u0441\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u0435 \u042d\u0440\u043b\u0430\u043d\u0433\u0430). \u0418\u0437 \u044d\u0442\u043e\u0433\u043e \u0441\u043e\u043e\u0442\u043d\u043e\u0448\u0435\u043d\u0438\u044f \u0438 \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442 \u0432\u044b\u0448\u0435\u0443\u043f\u043e\u043c\u044f\u043d\u0443\u0442\u044b\u0439 \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c GA2:<\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">\u0414\u043e\u043a\u0430\u0437\u0430\u0442\u0435\u043b\u044c\u0441\u0442\u0432\u043e<\/b><\/p>\n<div class=\"spoiler_text\">\u042d\u0442\u043e\u0442 \u0444\u0430\u043a\u0442 \u043b\u0435\u0433\u043a\u043e \u0434\u043e\u043a\u0430\u0437\u0430\u0442\u044c, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044f \u0445\u0430\u0440\u0430\u043a\u0442\u0435\u0440\u0438\u0441\u0442\u0438\u0447\u0435\u0441\u043a\u0443\u044e \u0444\u0443\u043d\u043a\u0446\u0438\u044e \u2014 \u043e\u0431\u0440\u0430\u0442\u043d\u043e\u0435 \u043f\u0440\u0435\u043e\u0431\u0440\u0430\u0437\u043e\u0432\u0430\u043d\u0438\u0435 \u0424\u0443\u0440\u044c\u0435 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u043f\u043b\u043e\u0442\u043d\u043e\u0441\u0442\u0438 \u0440\u0430\u0441\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u044f:<\/p>\n<div style=\"text-align:center;\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/files\/6da\/ea3\/788\/6daea37880834b2d81604bbb43fc7f3c.png\" \/><\/div>\n<p>  \u0423 \u044d\u0442\u043e\u0439 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u0435\u0441\u0442\u044c \u043f\u043e\u043b\u0435\u0437\u043d\u043e\u0435 \u0441\u0432\u043e\u0439\u0441\u0442\u0432\u043e \u0434\u043b\u044f \u0441\u0443\u043c\u043c\u044b \u0434\u0432\u0443\u0445 \u043d\u0435\u0437\u0430\u0432\u0438\u0441\u0438\u043c\u044b\u0445 \u0441\u043b\u0443\u0447\u0430\u0439\u043d\u044b\u0445 \u0432\u0435\u043b\u0438\u0447\u0438\u043d:<\/p>\n<div style=\"text-align:center;\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/files\/c5e\/a45\/366\/c5ea4536606a416680880544e9e52be1.png\" \/><\/div>\n<p>  \u041f\u0443\u0441\u0442\u044c E \u2014 \u0441\u043b\u0443\u0447\u0430\u0439\u043d\u0430\u044f \u0432\u0435\u043b\u0438\u0447\u0438\u043d\u0430 \u0441 \u044d\u043a\u0441\u043f\u043e\u043d\u0435\u043d\u0446\u0438\u0430\u043b\u044c\u043d\u044b\u043c \u0440\u0430\u0441\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u0435\u043c:<\/p>\n<div style=\"text-align:center;\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/files\/73a\/933\/c47\/73a933c471aa4e27adcfe0646e0a01f1.png\" \/><\/div>\n<p>  \u0422\u043e\u0433\u0434\u0430 \u0435\u0451 \u0445\u0430\u0440\u0430\u043a\u0442\u0435\u0440\u0438\u0441\u0442\u0438\u0447\u0435\u0441\u043a\u0430\u044f \u0444\u0443\u043d\u043a\u0446\u0438\u044f:<\/p>\n<div style=\"text-align:center;\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/files\/a65\/867\/180\/a65867180a854b1caeedb87c36d6668f.png\" \/><\/div>\n<p>  \u041d\u0430\u043c \u043d\u0443\u0436\u043d\u043e \u0443\u0437\u043d\u0430\u0442\u044c \u0440\u0430\u0441\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u0435 \u0441\u043b\u0443\u0447\u0430\u0439\u043d\u043e\u0439 \u0432\u0435\u043b\u0438\u0447\u0438\u043d\u044b \u0440\u0430\u0432\u043d\u043e\u0439 \u0443\u0434\u0432\u043e\u0435\u043d\u043d\u043e\u0439 \u0441\u0443\u043c\u043c\u0435 \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u044b\u0445 \u044d\u043a\u0441\u043f\u043e\u043d\u0435\u043d\u0446\u0438\u0430\u043b\u044c\u043d\u044b\u0445 \u0432\u0435\u043b\u0438\u0447\u0438\u043d:<\/p>\n<div style=\"text-align:center;\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/files\/df1\/2e0\/6dd\/df12e06ddf7a4404b6f91d67d36587d4.png\" \/><\/div>\n<p>  \u0415\u0441\u043b\u0438 \u043e\u043d\u043e \u0441\u043e\u0432\u043f\u0430\u0434\u0430\u0435\u0442 \u0441 \u0440\u0430\u0441\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u0435\u043c \u0445\u0438-\u043a\u0432\u0430\u0434\u0440\u0430\u0442, \u0442\u043e \u0435\u0433\u043e \u0445\u0430\u0440\u0430\u043a\u0442\u0435\u0440\u0438\u0441\u0442\u0438\u0447\u0435\u0441\u043a\u0430\u044f \u0444\u0443\u043d\u043a\u0446\u0438\u044f:<\/p>\n<div style=\"text-align:center;\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/files\/bd3\/35a\/345\/bd335a345916482b900d6f992c7b8280.png\" \/><\/div>\n<p>  \u0414\u043e\u043a\u0430\u0436\u0435\u043c \u044d\u0442\u043e. \u0420\u0430\u043d\u0435\u0435 \u0431\u044b\u043b\u043e \u0443\u043f\u043e\u043c\u044f\u043d\u0443\u0442\u043e \u0442\u0430\u043a\u0436\u0435, \u0447\u0442\u043e \u0434\u043b\u044f \u044d\u043a\u0441\u043f\u043e\u043d\u0435\u043d\u0446\u0438\u0430\u043b\u044c\u043d\u043e\u0433\u043e \u0440\u0430\u0441\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u044f:<\/p>\n<div style=\"text-align:center;\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/files\/f11\/d1a\/ed3\/f11d1aed3a174b1088898f7292c85261.png\" \/><\/div>\n<p>  \u0418\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044f \u044d\u0442\u043e \u0441\u0432\u043e\u0439\u0441\u0442\u0432\u043e, \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u043c:<\/p>\n<div style=\"text-align:center;\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/files\/bbc\/1b9\/3dd\/bbc1b93dd4814c3bba2c486b393b031d.png\" \/><\/div>\n<p>  q.e.d.  <\/div>\n<\/div>\n<p>  <\/p>\n<pre><code>double ChiSquared(int k) {     \/\/ ~ Gamma(k \/ 2, 2)     double x = ((k & 1) ? GA2(0.5 * k) : GA1(k &gt;&gt; 1));     return x + x; } <\/code><\/pre>\n<p>  \u0418\u0437 \u044d\u0442\u043e\u0433\u043e \u0441\u0432\u043e\u0439\u0441\u0442\u0432\u0430 \u0441\u043b\u0435\u0434\u0443\u0435\u0442 \u043f\u0440\u0438\u043c\u0435\u0447\u0430\u0442\u0435\u043b\u044c\u043d\u044b\u0439 \u0444\u0430\u043a\u0442: \u0435\u0441\u043b\u0438 \u0432\u044b\u0431\u0438\u0440\u0430\u0442\u044c \u0442\u043e\u0447\u043a\u0443 \u043d\u0430 \u043f\u043b\u043e\u0441\u043a\u043e\u0441\u0442\u0438 \u0441\u043e \u0441\u043b\u0443\u0447\u0430\u0439\u043d\u044b\u043c\u0438 \u0438 \u043d\u043e\u0440\u043c\u0430\u043b\u044c\u043d\u044b\u043c\u0438 \u043a\u043e\u043e\u0440\u0434\u0438\u043d\u0430\u0442\u0430\u043c\u0438 (x, y), \u0442\u043e \u0440\u0430\u0441\u0441\u0442\u043e\u044f\u043d\u0438\u0435 \u043e\u0442 (0,0) \u0434\u043e \u044d\u0442\u043e\u0439 \u0442\u043e\u0447\u043a\u0438 \u0431\u0443\u0434\u0435\u0442 \u0440\u0430\u0441\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u043e \u044d\u043a\u0441\u043f\u043e\u043d\u0435\u043d\u0446\u0438\u0430\u043b\u044c\u043d\u043e.<\/p>\n<h4>\u041b\u043e\u0433\u043d\u043e\u0440\u043c\u0430\u043b\u044c\u043d\u043e\u0435 \u0440\u0430\u0441\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u0435<\/h4>\n<p>  <\/p>\n<div style=\"text-align:center;\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/files\/e8c\/31f\/d40\/e8c31fd4022d490dbe0e7b5f8f687298.png\" \/><\/div>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/files\/e86\/36e\/6ec\/e8636e6ec7c341f3b0f6f05ac3eb3ee9.png\"\/><br \/>  \u041b\u044e\u0434\u0438, \u0440\u0430\u0431\u043e\u0442\u0430\u044e\u0449\u0438\u0435 \u0441 \u043c\u0430\u0442\u0435\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438\u043c\u0438 \u043c\u043e\u0434\u0435\u043b\u044f\u043c\u0438 \u043d\u0430 \u0444\u0438\u043d\u0430\u043d\u0441\u043e\u0432\u044b\u0445 \u0440\u044b\u043d\u043a\u0430\u0445, \u043e \u043b\u043e\u0433\u043d\u043e\u0440\u043c\u0430\u043b\u044c\u043d\u043e\u043c \u0440\u0430\u0441\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u0438 \u0437\u043d\u0430\u044e\u0442 \u043d\u0435 \u043f\u043e\u043d\u0430\u0441\u043b\u044b\u0448\u043a\u0435. \u0414\u043b\u044f \u043b\u043e\u0433\u043d\u043e\u0440\u043c\u0430\u043b\u044c\u043d\u043e\u0433\u043e, \u043b\u043e\u0433-\u041a\u043e\u0448\u0438, \u043b\u043e\u0433-\u043b\u043e\u0433\u0438\u0441\u0442\u0438\u0447\u0435\u0441\u043a\u043e\u0433\u043e \u0440\u0430\u0441\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u0439 \u0435\u0441\u0442\u044c \u043e\u0434\u0438\u043d \u043f\u0440\u043e\u0441\u0442\u0435\u0446\u043a\u0438\u0439 \u0441\u043f\u043e\u0441\u043e\u0431 \u2014 \u0432\u0437\u044f\u0442\u044c \u044d\u043a\u0441\u043f\u043e\u043d\u0435\u043d\u0442\u0443. \u041a \u0441\u043e\u0436\u0430\u043b\u0435\u043d\u0438\u044e, \u0441\u043f\u043e\u0441\u043e\u0431\u0430 \u0431\u044b\u0441\u0442\u0440\u0435\u0435 \u044f \u043d\u0435 \u0437\u043d\u0430\u044e, \u043e\u0434\u043d\u0430\u043a\u043e, \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e, \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u0435\u0442 \u0441\u043f\u043e\u0441\u043e\u0431 \u0433\u0435\u043d\u0435\u0440\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043f\u043e\u0434\u043e\u0431\u043d\u044b\u0435 \u0432\u0435\u043b\u0438\u0447\u0438\u043d\u044b \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u0440\u0430\u0441\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u044f \u041b\u0435\u0432\u0438 \u0438\/\u0438\u043b\u0438 \u0440\u0430\u0441\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u044f \u0445\u0438-\u043a\u0432\u0430\u0434\u0440\u0430\u0442. \u041f\u043e\u0441\u043c\u043e\u0442\u0440\u0438\u0442\u0435, \u043a\u0430\u043a \u043e\u043d\u0438 \u043f\u043e\u0445\u043e\u0436\u0438. \u0410 \u043f\u043e\u043a\u0430 \u0442\u0430\u043a:<\/p>\n<pre><code>double LogNormal(double mu, double sigma) {     return exp(Normal(mu, sigma)); } <\/code><\/pre>\n<h4>\u041b\u043e\u0433\u0438\u0441\u0442\u0438\u0447\u0435\u0441\u043a\u043e\u0435 \u0440\u0430\u0441\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u0435<\/h4>\n<p>  <\/p>\n<div style=\"text-align:center;\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/files\/588\/c68\/3ef\/588c683ef54743968b26d22238a6366d.png\" \/><\/div>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/files\/7a4\/208\/fe4\/7a4208fe40ff43af959dc3339dd77af6.png\"\/><br \/>  \u041b\u043e\u0433\u0438\u0441\u0442\u0438\u0447\u0435\u0441\u043a\u043e\u0435 \u0440\u0430\u0441\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u0435 \u043e\u0447\u0435\u043d\u044c \u043f\u043e\u0445\u043e\u0436\u0435 \u043d\u0430 \u043d\u043e\u0440\u043c\u0430\u043b\u044c\u043d\u043e\u0435, \u043d\u043e \u0438\u043c\u0435\u0435\u0442 \u0431\u043e\u043b\u0435\u0435 \u0442\u044f\u0436\u0435\u043b\u044b\u0435 \u0445\u0432\u043e\u0441\u0442\u044b, \u0433\u0435\u043d\u0435\u0440\u0438\u0440\u0443\u0435\u0442\u0441\u044f \u0434\u043e\u0432\u043e\u043b\u044c\u043d\u043e \u043b\u0435\u0433\u043a\u043e \u0447\u0435\u0440\u0435\u0437 \u0440\u0430\u0432\u043d\u043e\u043c\u0435\u0440\u043d\u043e\u0435 \u0440\u0430\u0441\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u0435:<\/p>\n<pre><code>double Logistic(double mu, double s) {     return mu + s * log(1.0 \/ Uniform(0, 1) - 1); } <\/code><\/pre>\n<p>  \u041d\u0430\u043f\u043e\u0441\u043b\u0435\u0434\u043e\u043a \u0432\u043a\u0440\u0430\u0442\u0446\u0435 \u043e \u043d\u0435 \u0432\u0441\u0435\u0433\u0434\u0430 \u0431\u044b\u0441\u0442\u0440\u044b\u0445, \u043d\u043e \u043e\u0447\u0435\u043d\u044c \u043f\u0440\u043e\u0441\u0442\u044b\u0445 \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u0430\u0445 \u0434\u043b\u044f \u0434\u0440\u0443\u0433\u0438\u0445 \u043f\u043e\u043f\u0443\u043b\u044f\u0440\u043d\u044b\u0445 \u0440\u0430\u0441\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u0439:<\/p>\n<pre><code>double Erlang(int k, double l) {     return GA1(k) \/ l; }  double Weibull(double l, double k) {     return l * pow(Exponential(1), 1.0 \/ k); }  double Rayleigh(double sigma) {     return sigma * sqrt(Exponential(0.5)); }  double StudentT(int v) {     if (v == 1)         return Cauchy(0, 1);     return Normal(0, 1) \/ sqrt(ChiSquared(v) \/ v); }  double FisherSnedecor(int d1, int d2) {     double numerator = d2 * ChiSquared(d1);     double denominator = d1 * ChiSquared(d2);     return numerator \/ denominator; }  double Beta(double a, double b) {     if (a == b)     {         int iter = 0;         do {             double u1 = Uniform(0, 1);             double u2 = Uniform(0, 1);             if (u2 &lt;= pow(4 * u1 * (1 - u1), alpha - 1))                 return u1;         } while (++iter &lt;= 1e9); \/\/ one billion should be enough         return 0; \/\/ fail     }     double x = Gamma(a);     return x \/ (x + Gamma(b)); } <\/code><\/pre>\n<div class=\"clear\"><\/div>\n<p> \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"http:\/\/habrahabr.ru\/post\/263993\/\"> http:\/\/habrahabr.ru\/post\/263993\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<br \/>\n<blockquote><p>\u0413\u0435\u043d\u0435\u0440\u0430\u0442\u043e\u0440 \u0441\u043b\u0443\u0447\u0430\u0439\u043d\u044b\u0445 \u0447\u0438\u0441\u0435\u043b \u0432\u043e \u043c\u043d\u043e\u0433\u043e\u043c \u043f\u043e\u0434\u043e\u0431\u0435\u043d \u0441\u0435\u043a\u0441\u0443: \u043a\u043e\u0433\u0434\u0430 \u043e\u043d \u0445\u043e\u0440\u043e\u0448 \u2014 \u044d\u0442\u043e \u043f\u0440\u0435\u043a\u0440\u0430\u0441\u043d\u043e, \u043a\u043e\u0433\u0434\u0430 \u043e\u043d \u043f\u043b\u043e\u0445, \u0432\u0441\u0435 \u0440\u0430\u0432\u043d\u043e \u043f\u0440\u0438\u044f\u0442\u043d\u043e (\u0414\u0436\u043e\u0440\u0434\u0436 \u041c\u0430\u0440\u0441\u0430\u043b\u044c\u044f, 1984)<\/p><\/blockquote>\n<p>  \u041f\u043e\u043f\u0443\u043b\u044f\u0440\u043d\u043e\u0441\u0442\u044c \u0441\u0442\u043e\u0445\u0430\u0441\u0442\u0438\u0447\u0435\u0441\u043a\u0438\u0445 \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u043e\u0432 \u0432\u0441\u0435 \u0440\u0430\u0441\u0442\u0435\u0442. \u041c\u043d\u043e\u0433\u0438\u0435 \u0438\u0437 \u043d\u0438\u0445 \u0431\u0430\u0437\u0438\u0440\u0443\u044e\u0442\u0441\u044f \u043d\u0430 \u0433\u0435\u043d\u0435\u0440\u0430\u0446\u0438\u0438 \u0431\u043e\u043b\u044c\u0448\u043e\u0433\u043e \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u0430 \u0440\u0430\u0437\u043b\u0438\u0447\u043d\u044b\u0445 \u0441\u043b\u0443\u0447\u0430\u0439\u043d\u044b\u0445 \u0432\u0435\u043b\u0438\u0447\u0438\u043d. \u0414\u0430\u043b\u0435\u043a\u043e \u043d\u0435 \u0432\u0441\u0435\u0433\u0434\u0430 \u0440\u0430\u0432\u043d\u043e\u043c\u0435\u0440\u043d\u043e \u0440\u0430\u0441\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u043d\u044b\u0445. \u0417\u0434\u0435\u0441\u044c \u044f \u043f\u043e\u043f\u044b\u0442\u0430\u043b\u0441\u044f \u0441\u043e\u0431\u0440\u0430\u0442\u044c \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044e \u043e \u0431\u044b\u0441\u0442\u0440\u044b\u0445 \u0438 \u0442\u043e\u0447\u043d\u044b\u0445 \u0433\u0435\u043d\u0435\u0440\u0430\u0442\u043e\u0440\u0430\u0445 \u0441\u043b\u0443\u0447\u0430\u0439\u043d\u044b\u0445 \u0432\u0435\u043b\u0438\u0447\u0438\u043d \u0441 \u0438\u0437\u0432\u0435\u0441\u0442\u043d\u044b\u043c\u0438 \u0440\u0430\u0441\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u044f\u043c\u0438. \u0417\u0430\u0434\u0430\u0447\u0438 \u043c\u043e\u0433\u0443\u0442 \u0431\u044b\u0442\u044c \u0440\u0430\u0437\u043d\u044b\u043c\u0438, \u0440\u0430\u0437\u043d\u044b\u043c\u0438 \u043c\u043e\u0433\u0443\u0442 \u0431\u044b\u0442\u044c \u0438 \u043a\u0440\u0438\u0442\u0435\u0440\u0438\u0438. \u041a\u043e\u043c\u0443-\u0442\u043e \u0432\u0430\u0436\u043d\u043e \u0432\u0440\u0435\u043c\u044f \u0433\u0435\u043d\u0435\u0440\u0430\u0446\u0438\u0438, \u043a\u043e\u043c\u0443-\u0442\u043e \u2014 \u0442\u043e\u0447\u043d\u043e\u0441\u0442\u044c, \u043a\u043e\u043c\u0443-\u0442\u043e \u2014 \u043a\u0440\u0438\u043f\u0442\u043e\u0443\u0441\u0442\u043e\u0439\u0447\u0438\u0432\u043e\u0441\u0442\u044c, \u043a\u043e\u043c\u0443-\u0442\u043e \u2014 \u0441\u043a\u043e\u0440\u043e\u0441\u0442\u044c \u0441\u0445\u043e\u0434\u0438\u043c\u043e\u0441\u0442\u0438. \u041b\u0438\u0447\u043d\u043e \u044f \u0438\u0441\u0445\u043e\u0434\u0438\u043b \u0438\u0437 \u043f\u0440\u0435\u0434\u043f\u043e\u043b\u043e\u0436\u0435\u043d\u0438\u044f, \u0447\u0442\u043e \u043c\u044b \u0438\u043c\u0435\u0435\u043c \u043d\u0435\u043a\u0438\u0439 \u0431\u0430\u0437\u043e\u0432\u044b\u0439 \u0433\u0435\u043d\u0435\u0440\u0430\u0442\u043e\u0440, \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u044e\u0449\u0438\u0439 \u043f\u0441\u0435\u0432\u0434\u043e\u0441\u043b\u0443\u0447\u0430\u0439\u043d\u043e\u0435 \u0446\u0435\u043b\u043e\u0435 \u0447\u0438\u0441\u043b\u043e, \u0440\u0430\u0432\u043d\u043e\u043c\u0435\u0440\u043d\u043e \u0440\u0430\u0441\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u043d\u043e\u0435 \u043e\u0442 0 \u0434\u043e \u043d\u0435\u043a\u043e\u0433\u043e RAND_MAX<\/p>\n<pre><code>unsigned long BasicRandGenerator() {     unsigned long randomVariable;     \/\/ some magic here     ...     return randomVariable; } <\/code><\/pre>\n<p>  \u0438 \u0447\u0442\u043e \u044d\u0442\u043e\u0442 \u0433\u0435\u043d\u0435\u0440\u0430\u0442\u043e\u0440 \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u0431\u044b\u0441\u0442\u0440\u044b\u0439. \u042f \u0438\u043c\u0435\u044e \u0432\u0432\u0438\u0434\u0443, \u0447\u0442\u043e \u0434\u0435\u0448\u0435\u0432\u043b\u0435 \u0441\u0433\u0435\u043d\u0435\u0440\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0441 \u0434\u0435\u0441\u044f\u0442\u043e\u043a \u0441\u043b\u0443\u0447\u0430\u0439\u043d\u044b\u0445 \u0447\u0438\u0441\u0435\u043b, \u043d\u0435\u0436\u0435\u043b\u0438 \u0447\u0435\u043c \u043f\u043e\u0441\u0447\u0438\u0442\u0430\u0442\u044c \u043b\u043e\u0433\u0430\u0440\u0438\u0444\u043c \u0438\u043b\u0438 \u0432\u043e\u0437\u0432\u0435\u0441\u0442\u0438 \u0432 \u0441\u0442\u0435\u043f\u0435\u043d\u044c \u043e\u0434\u043d\u043e \u0438\u0437 \u043d\u0438\u0445. \u042d\u0442\u043e \u043c\u043e\u0433\u0443\u0442 \u0431\u044b\u0442\u044c \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u044b\u0435 \u0433\u0435\u043d\u0435\u0440\u0430\u0442\u043e\u0440\u044b: std::rand(), rand \u0432 MATLAB, Java.util.Random \u0438 \u0442.\u0434. \u041d\u043e \u0438\u043c\u0435\u0439\u0442\u0435 \u0432\u0432\u0438\u0434\u0443, \u0447\u0442\u043e \u043f\u043e\u0434\u043e\u0431\u043d\u044b\u0435 \u0433\u0435\u043d\u0435\u0440\u0430\u0442\u043e\u0440\u044b \u0440\u0435\u0434\u043a\u043e \u043f\u043e\u0434\u0445\u043e\u0434\u044f\u0442 \u0434\u043b\u044f \u0441\u0435\u0440\u044c\u0435\u0437\u043d\u043e\u0439 \u0440\u0430\u0431\u043e\u0442\u044b. \u0417\u0430\u0447\u0430\u0441\u0442\u0443\u044e \u043e\u043d\u0438 \u043f\u0440\u043e\u0432\u0430\u043b\u0438\u0432\u0430\u044e\u0442 \u0440\u0430\u0437\u043d\u044b\u0435 \u0441\u0442\u0430\u0442\u0438\u0441\u0442\u0438\u0447\u0435\u0441\u043a\u0438\u0435 \u0442\u0435\u0441\u0442\u044b. \u0410 \u0442\u0430\u043a\u0436\u0435, \u043f\u043e\u043c\u043d\u0438\u0442\u0435, \u0447\u0442\u043e \u0432\u044b \u043f\u043e\u043b\u043d\u043e\u0441\u0442\u044c\u044e \u0437\u0430\u0432\u0438\u0441\u0438\u0442\u0435 \u043e\u0442 \u043d\u0438\u0445 \u0438 \u043b\u0443\u0447\u0448\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0441\u0432\u043e\u0439 \u0441\u043e\u0431\u0441\u0442\u0432\u0435\u043d\u043d\u044b\u0439 \u0433\u0435\u043d\u0435\u0440\u0430\u0442\u043e\u0440, \u0447\u0442\u043e\u0431\u044b \u0438\u043c\u0435\u0442\u044c \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u043e \u0435\u0433\u043e \u0440\u0430\u0431\u043e\u0442\u0435.<\/p>\n<p>  \u0412 \u0441\u0442\u0430\u0442\u044c\u0435 \u044f \u0431\u0443\u0434\u0443 \u0440\u0430\u0441\u0441\u043a\u0430\u0437\u044b\u0432\u0430\u0442\u044c \u043e\u0431 \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u0430\u0445, \u0441\u0443\u0442\u044c \u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u0434\u043e\u043b\u0436\u043d\u0430 \u0431\u044b\u0442\u044c \u043f\u043e\u043d\u044f\u0442\u043d\u0430 \u043a\u0430\u0436\u0434\u043e\u043c\u0443, \u043a\u0442\u043e \u0445\u043e\u0442\u044c \u0438\u043d\u043e\u0433\u0434\u0430 \u0441\u0442\u0430\u043b\u043a\u0438\u0432\u0430\u043b\u0441\u044f \u0441 \u0442\u0435\u043e\u0440\u0438\u0435\u0439 \u0432\u0435\u0440\u043e\u044f\u0442\u043d\u043e\u0441\u0442\u0435\u0439. \u0421\u043e\u0432\u0441\u0435\u043c \u043d\u0435\u043e\u0431\u044f\u0437\u0430\u0442\u0435\u043b\u044c\u043d\u043e \u0431\u044b\u0442\u044c \u0437\u043d\u0430\u043a\u043e\u043c\u044b\u043c \u0441 \u0442\u0435\u043e\u0440\u0438\u0435\u0439 \u043c\u0435\u0440\u044b, \u043a\u0430\u043a \u043f\u0440\u0430\u0432\u0438\u043b\u043e, \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u043f\u0440\u0438\u043c\u0435\u0440\u043d\u043e \u043f\u043e\u043d\u0438\u043c\u0430\u0442\u044c, \u0447\u0442\u043e \u0438\u0437 \u0441\u0435\u0431\u044f \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u044f\u044e\u0442 \u0444\u0443\u043d\u043a\u0446\u0438\u044f \u0440\u0430\u0441\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u044f \u0438 \u0444\u0443\u043d\u043a\u0446\u0438\u044f \u043f\u043b\u043e\u0442\u043d\u043e\u0441\u0442\u0438 \u0440\u0430\u0441\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u044f:<\/p>\n<div style=\"text-align:center;\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/files\/591\/8a7\/1dc\/5918a71dcb1e4a6bb432c273bc65541d.png\" \/><\/div>\n<p>  \u041a\u0430\u0436\u0434\u044b\u0439 \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c \u044f \u0431\u0443\u0434\u0443 \u0441\u043e\u043f\u0440\u043e\u0432\u043e\u0436\u0434\u0430\u0442\u044c \u043a\u043e\u0434\u043e\u043c, \u043d\u0435\u0431\u043e\u043b\u044c\u0448\u0438\u043c \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e\u043c \u043c\u0430\u0442\u0435\u043c\u0430\u0442\u0438\u043a\u0438 \u0438 \u0433\u0438\u0441\u0442\u043e\u0433\u0440\u0430\u043c\u043c\u043e\u0439 \u0438\u0437 \u0434\u0435\u0441\u044f\u0442\u043a\u0430 \u043c\u0438\u043b\u043b\u0438\u043e\u043d\u043e\u0432 \u0441\u0433\u0435\u043d\u0435\u0440\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0445 \u0441\u043b\u0443\u0447\u0430\u0439\u043d\u044b\u0445 \u0432\u0435\u043b\u0438\u0447\u0438\u043d.<\/p>\n<h4>\u0420\u0430\u0432\u043d\u043e\u043c\u0435\u0440\u043d\u043e\u0435 \u0440\u0430\u0441\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u0435<\/h4>\n<p>  <\/p>\n<div style=\"text-align:center;\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/files\/abf\/358\/849\/abf35884902446349f8fd3516788f894.png\" \/><\/div>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/files\/ccb\/249\/991\/ccb24999157e4f0d9b268e4b6bb7374d.png\"\/><\/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-262756","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/262756","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=262756"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/262756\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=262756"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=262756"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=262756"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}