{"id":1031,"date":"2021-07-12T07:10:37","date_gmt":"2021-07-12T07:10:37","guid":{"rendered":"https:\/\/www.bearloga.space\/?page_id=1031"},"modified":"2021-07-12T07:10:37","modified_gmt":"2021-07-12T07:10:37","slug":"numpy-chast-3-random","status":"publish","type":"page","link":"https:\/\/www.bearloga.space\/uk\/numpy-chast-3-random\/","title":{"rendered":"NumPy, \u0447\u0430\u0441\u0442\u044c 3: random"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\">\u0417\u0434\u0440\u0430\u0432\u0441\u0442\u0432\u0443\u0439\u0442\u0435! \u042f \u043f\u0440\u043e\u0434\u043e\u043b\u0436\u0430\u044e \u0440\u0430\u0431\u043e\u0442\u0443 \u043d\u0430\u0434 \u043f\u043e\u0441\u043e\u0431\u0438\u0435\u043c \u043f\u043e python-\u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0435 NumPy.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\u0412\u00a0<a href=\"https:\/\/www.bearloga.space\/numpy-chast-2-bazovye-operaczii-nad-massivami\" target=\"_blank\" rel=\"noreferrer noopener\">\u043f\u0440\u043e\u0448\u043b\u043e\u0439 \u0447\u0430\u0441\u0442\u0438<\/a>\u00a0\u043c\u044b \u043d\u0430\u0443\u0447\u0438\u043b\u0438\u0441\u044c \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u0441 \u043c\u0430\u0441\u0441\u0438\u0432\u0430\u043c\u0438.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\u0421\u0435\u0433\u043e\u0434\u043d\u044f \u043c\u044b \u0443\u0437\u043d\u0430\u0435\u043c, \u043a\u0430\u043a \u0441\u043e\u0437\u0434\u0430\u0432\u0430\u0442\u044c \u043c\u0430\u0441\u0441\u0438\u0432\u044b \u0438\u0437 \u0441\u043b\u0443\u0447\u0430\u0439\u043d\u044b\u0445 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u043e\u0432 \u0438 \u043a\u0430\u043a \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u0441\u043e \u0441\u043b\u0443\u0447\u0430\u0439\u043d\u044b\u043c\u0438 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u0430\u043c\u0438 \u0432 NumPy.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">\u041f\u0443\u0442\u044c \u043f\u0435\u0440\u0432\u044b\u0439<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">\u0421\u043e\u0437\u0434\u0430\u0432\u0430\u0442\u044c \u0441\u043f\u0438\u0441\u043a\u0438, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044f \u0432\u0441\u0442\u0440\u043e\u0435\u043d\u043d\u044b\u0439 \u043c\u043e\u0434\u0443\u043b\u044c random, \u0430 \u0437\u0430\u0442\u0435\u043c \u043f\u0440\u0435\u043e\u0431\u0440\u0430\u0437\u043e\u0432\u044b\u0432\u0430\u0442\u044c \u0438\u0445 \u0432 numpy.array:&gt;&gt;&gt;<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><\/pre>\n\n\n\n<pre class=\"wp-block-preformatted\"><code><strong>>>> import<\/strong> <strong>numpy<\/strong> <strong>as<\/strong> <strong>np<\/strong>\n<strong>>>> import<\/strong> <strong>random<\/strong>\n<strong>>>> <\/strong>np.array([random.random() <strong>for<\/strong> i <strong>in<\/strong> range(10)])\narray([ 0.99538667,  0.16860511,  0.78952804,  0.09676316,  0.86110208,\n        0.89674666,  0.56401347,  0.63431468,  0.51110935,  0.64944844])<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">\u041d\u043e \u0435\u0441\u0442\u044c \u0441\u043f\u043e\u0441\u043e\u0431 \u043b\u0443\u0447\u0448\u0435.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">numpy.random<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">\u0414\u043b\u044f \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u043c\u0430\u0441\u0441\u0438\u0432\u043e\u0432 \u0441\u043e \u0441\u043b\u0443\u0447\u0430\u0439\u043d\u044b\u043c\u0438 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u0430\u043c\u0438 \u0441\u043b\u0443\u0436\u0438\u0442 \u043c\u043e\u0434\u0443\u043b\u044c\u00a0<strong>numpy.random<\/strong>.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><code><strong>>>> import<\/strong> <strong>numpy<\/strong> <strong>as<\/strong> <strong>np<\/strong>  <em># \u0418\u043c\u043f\u043e\u0440\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c numpy \u0438 \u043f\u0438\u0441\u0430\u0442\u044c np.random<\/em>\n<strong>>>> <\/strong>np.random\n&lt;module 'numpy.random' from '\/usr\/local\/lib\/python3.4\/dist-packages\/numpy\/random\/__init__.py'>\n<strong>>>> import<\/strong> <strong>numpy.random<\/strong> <strong>as<\/strong> <strong>rand<\/strong>  <em># \u041c\u043e\u0436\u043d\u043e \u0438 \u043f\u0440\u0438\u0441\u0432\u043e\u0438\u0442\u044c \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u043e\u0435 \u0438\u043c\u044f. \u0412\u043e\u043f\u0440\u043e\u0441 \u0432\u043a\u0443\u0441\u0430<\/em>\n<strong>>>> <\/strong>rand\n&lt;module 'numpy.random' from '\/usr\/local\/lib\/python3.4\/dist-packages\/numpy\/random\/__init__.py'><\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\">\u0421\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u043c\u0430\u0441\u0441\u0438\u0432\u043e\u0432<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">\u0421\u0430\u043c\u044b\u0439 \u043f\u0440\u043e\u0441\u0442\u043e\u0439 \u0441\u043f\u043e\u0441\u043e\u0431 \u0437\u0430\u0434\u0430\u0442\u044c \u043c\u0430\u0441\u0441\u0438\u0432 \u0441\u043e \u0441\u043b\u0443\u0447\u0430\u0439\u043d\u044b\u043c\u0438 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u0430\u043c\u0438 &#8211; \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0444\u0443\u043d\u043a\u0446\u0438\u044e sample (\u0438\u043b\u0438 random, \u0438\u043b\u0438 random_sample, \u0438\u043b\u0438 ranf &#8211; \u044d\u0442\u043e \u0432\u0441\u0451 \u043e\u0434\u043d\u0430 \u0438 \u0442\u0430 \u0436\u0435 \u0444\u0443\u043d\u043a\u0446\u0438\u044f).<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><code><strong>>>> <\/strong>np.random.sample()\n0.6336371838734877\n<strong>>>> <\/strong>np.random.sample(3)\narray([ 0.53478558,  0.1441317 ,  0.15711313])\n<strong>>>> <\/strong>np.random.sample((2, 3))\narray([[ 0.12915769,  0.09448946,  0.58778985],\n       [ 0.45488207,  0.19335243,  0.22129977]])<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">\u0411\u0435\u0437 \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u043e\u0432 \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 \u043f\u0440\u043e\u0441\u0442\u043e \u0447\u0438\u0441\u043b\u043e \u0432 \u043f\u0440\u043e\u043c\u0435\u0436\u0443\u0442\u043a\u0435 [0, 1), \u0441 \u043e\u0434\u043d\u0438\u043c \u0446\u0435\u043b\u044b\u043c \u0447\u0438\u0441\u043b\u043e\u043c &#8211; \u043e\u0434\u043d\u043e\u043c\u0435\u0440\u043d\u044b\u0439 \u043c\u0430\u0441\u0441\u0438\u0432, \u0441 \u043a\u043e\u0440\u0442\u0435\u0436\u0435\u043c &#8211; \u043c\u0430\u0441\u0441\u0438\u0432 \u0441 \u0440\u0430\u0437\u043c\u0435\u0440\u0430\u043c\u0438, \u0443\u043a\u0430\u0437\u0430\u043d\u043d\u044b\u043c\u0438 \u0432 \u043a\u043e\u0440\u0442\u0435\u0436\u0435 (\u0432\u0441\u0435 \u0447\u0438\u0441\u043b\u0430 &#8211; \u0438\u0437 \u043f\u0440\u043e\u043c\u0435\u0436\u0443\u0442\u043a\u0430 [0, 1)).<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\u0421 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u0444\u0443\u043d\u043a\u0446\u0438\u0438 randint \u0438\u043b\u0438 random_integers \u043c\u043e\u0436\u043d\u043e \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u043c\u0430\u0441\u0441\u0438\u0432 \u0438\u0437 \u0446\u0435\u043b\u044b\u0445 \u0447\u0438\u0441\u0435\u043b. \u0410\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u044b: low, high, size: \u043e\u0442 \u043a\u0430\u043a\u043e\u0433\u043e, \u0434\u043e \u043a\u0430\u043a\u043e\u0433\u043e \u0447\u0438\u0441\u043b\u0430 (randint \u043d\u0435 \u0432\u043a\u043b\u044e\u0447\u0430\u0435\u0442 \u0432 \u0441\u0435\u0431\u044f \u044d\u0442\u043e \u0447\u0438\u0441\u043b\u043e, \u0430 random_integers \u0432\u043a\u043b\u044e\u0447\u0430\u0435\u0442), \u0438 size &#8211; \u0440\u0430\u0437\u043c\u0435\u0440\u044b \u043c\u0430\u0441\u0441\u0438\u0432\u0430.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><code><strong>>>> <\/strong>np.random.randint(0, 3, 10)\narray([0, 2, 0, 1, 1, 0, 2, 2, 2, 0])\n<strong>>>> <\/strong>np.random.random_integers(0, 3, 10)\narray([2, 2, 3, 3, 1, 1, 0, 2, 3, 2])\n<strong>>>> <\/strong>np.random.randint(0, 3, (2, 10))\narray([[0, 1, 2, 0, 0, 0, 1, 1, 1, 2],\n       [0, 0, 2, 2, 2, 0, 1, 2, 2, 1]])<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">\u0422\u0430\u043a\u0436\u0435 \u043c\u043e\u0436\u043d\u043e \u0433\u0435\u043d\u0435\u0440\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0447\u0438\u0441\u043b\u0430 \u0441\u043e\u0433\u043b\u0430\u0441\u043d\u043e \u0440\u0430\u0437\u043b\u0438\u0447\u043d\u044b\u043c\u00a0<a href=\"https:\/\/docs.scipy.org\/doc\/numpy\/reference\/routines.random.html#distributions\" target=\"_blank\" rel=\"noreferrer noopener\">\u0440\u0430\u0441\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u044f\u043c<\/a>\u00a0(\u0413\u0430\u0443\u0441\u0441\u0430, \u041f\u0430\u0440\u0435\u0442\u043e \u0438 \u0434\u0440\u0443\u0433\u0438\u0435). \u0427\u0430\u0449\u0435 \u0432\u0441\u0435\u0433\u043e \u043d\u0443\u0436\u043d\u043e \u0440\u0430\u0432\u043d\u043e\u043c\u0435\u0440\u043d\u043e\u0435 \u0440\u0430\u0441\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u0435, \u043a\u043e\u0442\u043e\u0440\u043e\u0435 \u043c\u043e\u0436\u043d\u043e \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u0441 \u043f\u043e\u043c\u043e\u0449\u044c \u0444\u0443\u043d\u043a\u0446\u0438\u0438 uniform.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><code><strong>>>> <\/strong>np.random.uniform(2, 8, (2, 10))\narray([[ 3.1517914 ,  3.10313483,  2.84007134,  3.21556436,  4.64531786,\n         2.99232714,  7.03064897,  4.38691765,  5.27488548,  2.63472454],\n       [ 6.39470358,  5.63084131,  4.69996748,  7.07260546,  7.44340813,\n         4.10722203,  7.52956646,  4.8596943 ,  3.97923973,  5.64505363]])<\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\">\u0412\u044b\u0431\u043e\u0440 \u0438 \u043f\u0435\u0440\u0435\u043c\u0435\u0448\u0438\u0432\u0430\u043d\u0438\u0435<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">\u041f\u0435\u0440\u0435\u043c\u0435\u0448\u0430\u0442\u044c NumPy \u043c\u0430\u0441\u0441\u0438\u0432 \u043c\u043e\u0436\u043d\u043e \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u0444\u0443\u043d\u043a\u0446\u0438\u0438 shuffle:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><strong>&gt;&gt;&gt; <\/strong>a = np.arange(10)\n<strong>&gt;&gt;&gt; <\/strong>a\narray([0, 1, 2, 3, 4, 5, 6, 7, 8, 9])\n<strong>&gt;&gt;&gt; <\/strong>np.random.shuffle(a)\n<strong>&gt;&gt;&gt; <\/strong>a\narray([2, 8, 7, 3, 5, 0, 4, 9, 1, 6])<\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">\u0422\u0430\u043a\u0436\u0435 \u043c\u043e\u0436\u043d\u043e \u043f\u0435\u0440\u0435\u043c\u0435\u0448\u0430\u0442\u044c \u043c\u0430\u0441\u0441\u0438\u0432 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u0444\u0443\u043d\u043a\u0446\u0438\u0438 permutation (\u043e\u043d\u0430, \u0432 \u043e\u0442\u043b\u0438\u0447\u0438\u0435 \u043e\u0442 shuffle, \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 \u043f\u0435\u0440\u0435\u043c\u0435\u0448\u0430\u043d\u043d\u044b\u0439 \u043c\u0430\u0441\u0441\u0438\u0432). \u0422\u0430\u043a\u0436\u0435 \u043e\u043d\u0430, \u0432\u044b\u0437\u0432\u0430\u043d\u043d\u0430\u044f \u0441 \u043e\u0434\u043d\u0438\u043c \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u043e\u043c (\u0446\u0435\u043b\u044b\u043c \u0447\u0438\u0441\u043b\u043e\u043c), \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 \u043f\u0435\u0440\u0435\u043c\u0435\u0448\u0430\u043d\u043d\u0443\u044e \u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u044c \u043e\u0442 0 \u0434\u043e N.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><strong>&gt;&gt;&gt; <\/strong>np.random.permutation(10)\narray([1, 2, 3, 8, 7, 9, 4, 6, 5, 0])<\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">\u0421\u0434\u0435\u043b\u0430\u0442\u044c \u0441\u043b\u0443\u0447\u0430\u0439\u043d\u0443\u044e \u0432\u044b\u0431\u043e\u0440\u043a\u0443 \u0438\u0437 \u043c\u0430\u0441\u0441\u0438\u0432\u0430 \u043c\u043e\u0436\u043d\u043e \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u0444\u0443\u043d\u043a\u0446\u0438\u0438 choice. \u041f\u0440\u043e \u043d\u0435\u0451 \u0441\u0442\u043e\u0438\u0442 \u0440\u0430\u0441\u0441\u043a\u0430\u0437\u0430\u0442\u044c \u043f\u043e\u0434\u0440\u043e\u0431\u043d\u0435\u0435.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>numpy.random.choice<\/strong>(a, size=None, replace=True, p=None)<\/p>\n\n\n\n<ul class=\"wp-block-list\"><li>a : \u043e\u0434\u043d\u043e\u043c\u0435\u0440\u043d\u044b\u0439 \u043c\u0430\u0441\u0441\u0438\u0432 \u0438\u043b\u0438 \u0447\u0438\u0441\u043b\u043e. \u0415\u0441\u043b\u0438 \u043c\u0430\u0441\u0441\u0438\u0432, \u0431\u0443\u0434\u0435\u0442 \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u044c\u0441\u044f \u0432\u044b\u0431\u043e\u0440\u043a\u0430 \u0438\u0437 \u043d\u0435\u0433\u043e. \u0415\u0441\u043b\u0438 \u0447\u0438\u0441\u043b\u043e, \u0442\u043e \u0432\u044b\u0431\u043e\u0440\u043a\u0430 \u0431\u0443\u0434\u0435\u0442 \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u044c\u0441\u044f \u0438\u0437 np.arange(a).<\/li><li>size : \u0440\u0430\u0437\u043c\u0435\u0440\u043d\u043e\u0441\u0442\u0438 \u043c\u0430\u0441\u0441\u0438\u0432\u0430. \u0415\u0441\u043b\u0438 None, \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442\u0441\u044f \u043e\u0434\u043d\u043e \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435.<\/li><li>replace : \u0435\u0441\u043b\u0438 True, \u0442\u043e \u043e\u0434\u043d\u043e \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u043c\u043e\u0436\u0435\u0442 \u0432\u044b\u0431\u0438\u0440\u0430\u0442\u044c\u0441\u044f \u0431\u043e\u043b\u0435\u0435 \u043e\u0434\u043d\u043e\u0433\u043e \u0440\u0430\u0437\u0430.<\/li><li>p : \u0432\u0435\u0440\u043e\u044f\u0442\u043d\u043e\u0441\u0442\u0438. \u042d\u0442\u043e \u043e\u0437\u043d\u0430\u0447\u0430\u0435\u0442, \u0447\u0442\u043e \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u044b \u043c\u043e\u0436\u043d\u043e \u0432\u044b\u0431\u0438\u0440\u0430\u0442\u044c \u0441 \u043d\u0435\u0440\u0430\u0432\u043d\u044b\u043c\u0438 \u0432\u0435\u0440\u043e\u044f\u0442\u043d\u043e\u0441\u0442\u044f\u043c\u0438. \u0415\u0441\u043b\u0438 \u043d\u0435 \u0437\u0430\u0434\u0430\u043d\u044b, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u0440\u0430\u0432\u043d\u043e\u043c\u0435\u0440\u043d\u043e\u0435 \u0440\u0430\u0441\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u0435.<\/li><\/ul>\n\n\n\n<pre class=\"wp-block-preformatted\"><strong>&gt;&gt;&gt; <\/strong>a = np.arange(10)\n<strong>&gt;&gt;&gt; <\/strong>a\narray([0, 1, 2, 3, 4, 5, 6, 7, 8, 9])\n<strong>&gt;&gt;&gt; <\/strong>np.random.choice(a, 10, p=[0.5, 0.25, 0.25, 0, 0, 0, 0, 0, 0, 0])\narray([0, 0, 0, 0, 1, 2, 0, 0, 1, 1])<\/pre>\n\n\n\n<h2 class=\"wp-block-heading\">\u0418\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f \u0433\u0435\u043d\u0435\u0440\u0430\u0442\u043e\u0440\u0430 \u0441\u043b\u0443\u0447\u0430\u0439\u043d\u044b\u0445 \u0447\u0438\u0441\u0435\u043b<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">seed(\u0447\u0438\u0441\u043b\u043e) &#8211; \u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f \u0433\u0435\u043d\u0435\u0440\u0430\u0442\u043e\u0440\u0430.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><strong>&gt;&gt;&gt; <\/strong>np.random.seed(1000)\n<strong>&gt;&gt;&gt; <\/strong>np.random.random(10)\narray([ 0.65358959,  0.11500694,  0.95028286,  0.4821914 ,  0.87247454,\n        0.21233268,  0.04070962,  0.39719446,  0.2331322 ,  0.84174072])\n<strong>&gt;&gt;&gt; <\/strong>np.random.seed(1000)\n<strong>&gt;&gt;&gt; <\/strong>np.random.random(10)\narray([ 0.65358959,  0.11500694,  0.95028286,  0.4821914 ,  0.87247454,\n        0.21233268,  0.04070962,  0.39719446,  0.2331322 ,  0.84174072])<\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">get_state \u0438 set_state &#8211; \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u044e\u0442 \u0438 \u0443\u0441\u0442\u0430\u043d\u0430\u0432\u043b\u0438\u0432\u0430\u044e\u0442 \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0435 \u0433\u0435\u043d\u0435\u0440\u0430\u0442\u043e\u0440\u0430.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><strong>&gt;&gt;&gt; <\/strong>np.random.seed(1000)\n<strong>&gt;&gt;&gt; <\/strong>state = np.random.get_state()\n<strong>&gt;&gt;&gt; <\/strong>np.random.random(10)\narray([ 0.65358959,  0.11500694,  0.95028286,  0.4821914 ,  0.87247454,\n        0.21233268,  0.04070962,  0.39719446,  0.2331322 ,  0.84174072])\n<strong>&gt;&gt;&gt; <\/strong>np.random.set_state(state)\n<strong>&gt;&gt;&gt; <\/strong>np.random.random(10)\narray([ 0.65358959,  0.11500694,  0.95028286,  0.4821914 ,  0.87247454,\n        0.21233268,  0.04070962,  0.39719446,  0.2331322 ,  0.84174072])<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>\u0417\u0434\u0440\u0430\u0432\u0441\u0442\u0432\u0443\u0439\u0442\u0435! \u042f \u043f\u0440\u043e\u0434\u043e\u043b\u0436\u0430\u044e \u0440\u0430\u0431\u043e\u0442\u0443 \u043d\u0430\u0434 \u043f\u043e\u0441\u043e\u0431\u0438\u0435\u043c \u043f\u043e python-\u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0435 NumPy. \u0412\u00a0\u043f\u0440\u043e\u0448\u043b\u043e\u0439 \u0447\u0430\u0441\u0442\u0438\u00a0\u043c\u044b \u043d\u0430\u0443\u0447\u0438\u043b\u0438\u0441\u044c \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u0441 \u043c\u0430\u0441\u0441\u0438\u0432\u0430\u043c\u0438. \u0421\u0435\u0433\u043e\u0434\u043d\u044f \u043c\u044b \u0443\u0437\u043d\u0430\u0435\u043c, \u043a\u0430\u043a \u0441\u043e\u0437\u0434\u0430\u0432\u0430\u0442\u044c [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":0,"parent":0,"menu_order":0,"comment_status":"closed","ping_status":"closed","template":"","meta":{"footnotes":""},"categories":[77],"tags":[],"class_list":["post-1031","page","type-page","status-publish","hentry","category-numpy"],"jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/www.bearloga.space\/uk\/wp-json\/wp\/v2\/pages\/1031","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.bearloga.space\/uk\/wp-json\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/www.bearloga.space\/uk\/wp-json\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/www.bearloga.space\/uk\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.bearloga.space\/uk\/wp-json\/wp\/v2\/comments?post=1031"}],"version-history":[{"count":0,"href":"https:\/\/www.bearloga.space\/uk\/wp-json\/wp\/v2\/pages\/1031\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.bearloga.space\/uk\/wp-json\/wp\/v2\/media?parent=1031"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.bearloga.space\/uk\/wp-json\/wp\/v2\/categories?post=1031"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.bearloga.space\/uk\/wp-json\/wp\/v2\/tags?post=1031"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}