{"id":161,"date":"2021-04-16T20:55:47","date_gmt":"2021-04-16T18:55:47","guid":{"rendered":"https:\/\/gilsteiner.com\/loragil\/?p=161"},"modified":"2022-04-23T16:37:15","modified_gmt":"2022-04-23T14:37:15","slug":"random-number-can-do-wonders","status":"publish","type":"post","link":"https:\/\/gilsteiner.com\/loragil\/2021\/04\/16\/random-number-can-do-wonders\/","title":{"rendered":"\u05de\u05e1\u05e4\u05e8\u05d9\u05dd \u05d0\u05e7\u05e8\u05d0\u05d9\u05d9\u05dd \u05d1\u05e0\u05d7\u05ea \u05e0\u05e7\u05e8\u05d0\u05d9\u05dd"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\">\u05db\u05dc \u05de\u05d9 \u05e9\u05e0\u05d3\u05e8\u05e9 \u05dc\u05e4\u05ea\u05d7 \u05de\u05e9\u05d7\u05e7 \u05d0\u05d9 \u05e4\u05e2\u05dd (\u05db\u05de\u05d5\u05e0\u05d9 \u05dc\u05de\u05e9\u05dc), \u05e1\u05d1\u05d9\u05e8 \u05dc\u05d4\u05e0\u05d9\u05d7 \u05e9\u05e0\u05ea\u05e7\u05dc \u05d1\u05e6\u05d5\u05e8\u05da \u05d1\u05d0\u05e7\u05e8\u05d0\u05d9\u05d5\u05ea. \u05d9\u05e9 \u05de\u05e9\u05d7\u05e7\u05d9\u05dd \u05e8\u05d1\u05d9\u05dd \u05d5\u05de\u05e6\u05d5\u05d9\u05d9\u05e0\u05d9\u05dd \u05e9\u05d0\u05d9\u05df \u05d1\u05d4\u05dd \u05d0\u05dc\u05de\u05e0\u05d8\u05d9\u05dd \u05e9\u05dc \u05d0\u05e7\u05e8\u05d0\u05d9\u05d5\u05ea, \u05db\u05d0\u05dc\u05d4 \u05e9\u05de\u05d6\u05de\u05d9\u05e0\u05d9\u05dd \u05e9\u05dc\u05d9\u05d8\u05d4 \u05d8\u05db\u05e0\u05d9\u05ea \u05de\u05d5\u05e9\u05dc\u05de\u05ea \u05de\u05ea\u05d5\u05da \u05ea\u05e8\u05d2\u05d5\u05dc \u05d7\u05d5\u05d6\u05e8. \u05e1\u05d5\u05e4\u05e8 \u05de\u05e8\u05d9\u05d5 \u05e2\u05d5\u05dc\u05d4 \u05dc\u05d9 \u05db\u05d3\u05d5\u05d2\u05de\u05d4 \u05de\u05d4\u05d9\u05e8\u05d4, \u05d0\u05d1\u05dc \u05e8\u05d5\u05d1 \u05d4\u05de\u05e9\u05d7\u05e7\u05d9\u05dd \u05e9\u05dc \u05e4\u05e2\u05dd, \u05db\u05dc\u05d5\u05de\u05e8 \u05de\u05de\u05e9-\u05de\u05de\u05e9 \u05e9\u05dc \u05e4\u05e2\u05dd, \u05d4\u05d9\u05d5 \u05db\u05d0\u05dc\u05d4. \u05e6\u05e4\u05d5\u05d9\u05d9\u05dd.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\u05d4\u05db\u05dc\u05d9 \u05d4\u05d1\u05e1\u05d9\u05e1\u05d9 \u05d1\u05d9\u05d5\u05ea\u05e8 \u05e9\u05dc \u05d0\u05e7\u05e8\u05d0\u05d9\u05d5\u05ea \u05d1-JS \u05d4\u05d5\u05d0 \u05e4\u05d5\u05e0\u05e7\u05e6\u05d9\u05d9\u05ea Math.random. \u05d6\u05d0\u05ea \u05e4\u05d5\u05e0\u05e7\u05e6\u05d9\u05d4 \u05e4\u05e9\u05d5\u05d8\u05d4 \u05dc\u05d4\u05e4\u05dc\u05d9\u05d0. \u05d4\u05d9\u05d0 \u05dc\u05d0 \u05de\u05e7\u05d1\u05dc\u05ea \u05e9\u05d5\u05dd \u05e4\u05e8\u05de\u05d8\u05e8 \u05d5\u05de\u05d7\u05d6\u05d9\u05e8\u05d4 \u05e2\u05e8\u05da \u05d0\u05e7\u05e8\u05d0\u05d9 \u05db\u05dc\u05e9\u05d4\u05d5 \u05d1\u05d9\u05df 0 (\u05db\u05d5\u05dc\u05dc) \u05dc\u05d1\u05d9\u05df 1 (\u05dc\u05d0 \u05db\u05d5\u05dc\u05dc).<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\u05d1\u05d5\u05d0\u05d5 \u05e0\u05ea\u05d7\u05d9\u05dc \u05dc\u05e9\u05d7\u05e7 \u05e2\u05dd \u05d6\u05d4 \u05e7\u05e6\u05ea. \u05e0\u05e0\u05d9\u05d7 \u05e9\u05d0\u05e0\u05d9 \u05e8\u05d5\u05e6\u05d4 \u05dc\u05e7\u05d1\u05dc \u05d1\u05d0\u05e7\u05e8\u05d0\u05d9 0 \u05d0\u05d5 1. \u05d0\u05dd \u05e0\u05e2\u05d2\u05dc \u05d0\u05ea \u05d4\u05e2\u05e8\u05da \u05d4\u05de\u05ea\u05e7\u05d1\u05dc, \u05ea\u05e6\u05d0 \u05dc\u05e0\u05d5 \u05d0\u05d7\u05ea \u05de\u05e9\u05ea\u05d9 \u05d4\u05d0\u05e4\u05e9\u05e8\u05d5\u05d9\u05d5\u05ea.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>Math.round(Math.random())<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">\u05e9\u05d9\u05de\u05d5 \u05dc\u05d1 \u05dc\u05e0\u05d9\u05d5\u05d0\u05e0\u05e1 \u05e7\u05d8\u05e0\u05d8\u05df. \u05d4\u05e4\u05d5\u05e0\u05e7\u05e6\u05d9\u05d4 \u05d4\u05e4\u05e0\u05d9\u05de\u05d9\u05ea \u05de\u05db\u05d9\u05dc\u05d4 \u05e2\u05e8\u05da \u05d0\u05d7\u05d3 \u05d9\u05d5\u05ea\u05e8 \u05e7\u05e8\u05d5\u05d1 \u05dc-0 \u05de\u05d0\u05e9\u05e8 \u05dc-1, \u05d4\u05e8\u05d9 \u05d6\u05d4 0 \u05d1\u05e2\u05e6\u05de\u05d5. \u05d0\u05d6 \u05d1\u05d0\u05d5\u05e4\u05df \u05ea\u05d9\u05d0\u05d5\u05e8\u05d8\u05d9 \u05d9\u05e9 \u05d4\u05e1\u05ea\u05d1\u05e8\u05d5\u05ea \u05d2\u05d1\u05d5\u05d4\u05d4 \u05d9\u05d5\u05ea\u05e8 \u05dc\u05e7\u05d1\u05dc 0 \u05de\u05d0\u05e9\u05e8 1, \u05d0\u05d1\u05dc \u05d6\u05d4 \u05dc\u05d2\u05de\u05e8\u05d9 \u05d1\u05e9\u05d5\u05dc\u05d9\u05d9\u05dd.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\u05de\u05d4 \u05d9\u05e7\u05e8\u05d4 \u05d0\u05dd \u05e0\u05e8\u05e6\u05d4 \u05dc\u05e7\u05d1\u05dc 0 \u05d0\u05d5 \u05de\u05e1\u05e4\u05e8 \u05d0\u05d7\u05e8 \u05de-1? \u05d4\u05e4\u05ea\u05e8\u05d5\u05df \u05e2\u05d3\u05d9\u05d9\u05df \u05e7\u05dc. \u05e0\u05e0\u05d9\u05d7 \u05e2\u05d1\u05d5\u05e8 0 \u05d0\u05d5 5:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>Math.round(Math.random()) * 5<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">\u05d5\u05d6\u05d4 \u05e2\u05d3\u05d9\u05d9\u05df \u05e4\u05e9\u05d5\u05d8 \u05de\u05d0\u05d3, \u05d2\u05dd \u05d0\u05dd \u05d4\u05de\u05e1\u05e4\u05e8 \u05d4\u05e8\u05d0\u05e9\u05d5\u05df \u05d0\u05d9\u05e0\u05d5 0. \u05e0\u05e0\u05d9\u05d7 3 \u05d5-5.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>3 + Math.round(Math.random()) * 2<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">\u05d4\u05ea\u05db\u05d5\u05e0\u05d4 \u05d4\u05d6\u05d0\u05ea \u05e9\u05de\u05d0\u05e4\u05e9\u05e8\u05ea \u05dc\u05e0\u05d5 \u05dc\u05e7\u05d1\u05dc \u05d0\u05d7\u05d3 \u05de\u05e9\u05e0\u05d9 \u05de\u05e1\u05e4\u05e8\u05d9\u05dd \u05d9\u05db\u05d5\u05dc\u05d4 \u05dc\u05e9\u05de\u05e9 \u05d0\u05d5\u05ea\u05e0\u05d5 \u05e2\u05d1\u05d5\u05e8 \u05de\u05e7\u05e8\u05d9\u05dd \u05d1\u05d4\u05dd \u05d0\u05e0\u05d7\u05e0\u05d5 \u05dc\u05d0 \u05e8\u05d5\u05e6\u05d9\u05dd \u05dc\u05e7\u05d1\u05dc \u05de\u05e1\u05e4\u05e8\u05d9\u05dd \u05d1\u05db\u05dc\u05dc, \u05d0\u05dc\u05d0 \u05db\u05dc \u05d3\u05d1\u05e8 \u05e9\u05d4\u05d5\u05d0 \u05de\u05ea\u05d5\u05da \u05e9\u05ea\u05d9 \u05d0\u05e4\u05e9\u05e8\u05d5\u05d9\u05d5\u05ea.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>const zeroOrOne = Math.round(Math.random())\nconst twoOptions = &#91;'one', 'two']\nconst random = twoOptions&#91;zeroOrOne]\n\n<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">\u05d1\u05d5\u05d0\u05d5 \u05e0\u05e2\u05d1\u05d5\u05e8 \u05dc\u05d9\u05d5\u05ea\u05e8 \u05de-2 \u05d0\u05e4\u05e9\u05e8\u05d5\u05d9\u05d5\u05ea. \u05d1\u05d3\u05d5\u05d2\u05de\u05d0\u05d5\u05ea \u05d4\u05e7\u05d5\u05d3\u05de\u05d5\u05ea \u05d4\u05e8\u05d7\u05d1\u05e0\u05d5 \u05d0\u05ea \u05d4\u05ea\u05d5\u05e6\u05d0\u05d4 \u05d4\u05de\u05ea\u05e7\u05d1\u05dc\u05ea. \u05d4\u05d7\u05d5\u05db\u05de\u05d4 \u05db\u05d0\u05df \u05d4\u05d9\u05d0 \u05dc\u05d4\u05d2\u05d3\u05d9\u05dc \u05d0\u05ea \u05de\u05e8\u05d7\u05d1 \u05d4\u05d0\u05e4\u05e9\u05e8\u05d5\u05d9\u05d5\u05ea \u05de\u05ea\u05d5\u05db\u05df \u05de\u05ea\u05e7\u05d1\u05dc\u05ea \u05d4\u05ea\u05d5\u05e6\u05d0\u05d4. \u05d0\u05d5 \u05d1\u05de\u05d9\u05dc\u05d9\u05dd \u05d0\u05d7\u05e8\u05d5\u05ea:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>Math.random() * n \/\/ between 0*n and almost 1*n<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">\u05d0\u05d1\u05dc \u05d1\u05d2\u05dc\u05dc \u05e9\u05e8\u05d5\u05d1\u05d9\u05e0\u05d5 \u05d1\u05e0\u05d9 \u05d0\u05d3\u05dd \u05d5\u05d0\u05e0\u05d7\u05e0\u05d5 \u05d0\u05d5\u05d4\u05d1\u05d9\u05dd \u05de\u05e1\u05e4\u05e8\u05d9\u05dd \u05e2\u05d2\u05d5\u05dc\u05d9\u05dd, \u05d0\u05d6 \u05d4\u05d1\u05d4 \u05e0\u05e2\u05d2\u05d9\u05dc\u05d4.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>Math.floor(Math.random() * 5) \/\/ 0, 1, 2, 3 or 4<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">\u05ea\u05e9\u05d0\u05dc\u05d5 \u05d1\u05e6\u05d3\u05e7 \u05dc\u05de\u05d4 floor \u05d5\u05dc\u05d0 round? \u05db\u05d9 \u05d4\u05e8\u05d0\u05e9\u05d5\u05e0\u05d4 \u05ea\u05d9\u05ea\u05df \u05dc\u05e0\u05d5 \u05de\u05e8\u05d7\u05d1 \u05d0\u05e4\u05e9\u05e8\u05d5\u05d9\u05d5\u05ea \u05d6\u05d4\u05d4 \u05dc\u05de\u05db\u05e4\u05d9\u05dc, \u05d1\u05e2\u05d5\u05d3 \u05d4\u05e9\u05e0\u05d9\u05d4 \u05ea\u05d4\u05d9\u05d4 \u05d2\u05d3\u05d5\u05dc\u05d4 \u05d1-1 \u05de\u05d4\u05de\u05db\u05e4\u05d9\u05dc (\u05de\u05d1\u05d9\u05e0\u05d9\u05dd \u05dc\u05de\u05d4?). \u05d4\u05d9\u05ea\u05e8\u05d5\u05df \u05e9\u05dc \u05d4\u05d0\u05e4\u05e9\u05e8\u05d5\u05ea \u05d4\u05e8\u05d0\u05e9\u05d5\u05e0\u05d4 \u05d4\u05d9\u05d0 \u05e9\u05d9\u05e9 \u05e7\u05e9\u05e8 \u05de\u05d5\u05d1\u05d4\u05e7 \u05d1\u05d9\u05df \u05d4\u05de\u05e1\u05e4\u05e8 \u05dc\u05ea\u05d5\u05e6\u05d0\u05d4 \u05d4\u05de\u05ea\u05e7\u05d1\u05dc\u05ea.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\u05e2\u05db\u05e9\u05d9\u05d5 \u05e0\u05e9\u05d0\u05e8 \u05e8\u05e7 \u05dc\u05e1\u05d2\u05d5\u05e8 \u05d0\u05ea \u05d4\u05e1\u05d9\u05e4\u05d5\u05e8 \u05e2\u05dd \u05e7\u05d1\u05d9\u05e2\u05ea \u05e9\u05e0\u05d9 \u05d4\u05e7\u05e6\u05d5\u05d5\u05ea \u05e9\u05dc \u05e9\u05dc \u05d4\u05ea\u05d5\u05e6\u05d0\u05d4 \u05d4\u05de\u05ea\u05e7\u05d1\u05dc\u05ea: \u05de\u05d9\u05e0\u05d9\u05de\u05d5\u05dd \u05d5\u05de\u05e7\u05e1\u05d9\u05de\u05d5\u05dd.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>function random(min, max) {\n  const range = max - min\n  return min + Math.floor(Math.random() * range)\n}<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">\u05d5\u05de\u05d4 \u05d0\u05dd \u05d0\u05e0\u05d7\u05e0\u05d5 \u05e8\u05d5\u05e6\u05d9\u05dd \u05dc\u05e7\u05d1\u05dc \u05e2\u05e8\u05da \u05d0\u05e7\u05e8\u05d0\u05d9 \u05de\u05ea\u05d5\u05da \u05e8\u05e9\u05d9\u05de\u05d4 \u05db\u05dc\u05e9\u05d4\u05d9? \u05e0\u05e9\u05dc\u05d1 \u05e4\u05d5\u05e0\u05e7\u05e6\u05d9\u05d4 \u05d7\u05d3\u05e9\u05d4 \u05e2\u05dd \u05d4\u05e7\u05d5\u05d3\u05de\u05ea.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>function getRandomValue(array) {\n  return array&#91;random(0, array.length)]\n}<\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\">\u05d1\u05d5\u05e0\u05d5\u05e1 \u05dc\u05de\u05ea\u05e7\u05d3\u05de\u05d9\u05dd<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">\u05d0\u05d1\u05dc \u05d0\u05d9\u05da \u05de\u05ea\u05e7\u05d1\u05dc \u05de\u05e1\u05e4\u05e8 \u05d0\u05e7\u05e8\u05d0\u05d9 \u05d1\u05db\u05dc\u05dc? \u05d0\u05dd \u05d7\u05d5\u05e9\u05d1\u05d9\u05dd \u05e2\u05dc \u05d6\u05d4, \u05d0\u05d9\u05df \u05d9\u05d5\u05ea\u05e8 \u05de\u05d3\u05d9 \u05d3\u05d1\u05e8\u05d9\u05dd \u05d0\u05e7\u05e8\u05d0\u05d9\u05d9\u05dd \u05d1\u05e2\u05d1\u05d5\u05d3\u05d4 \u05e9\u05dc \u05d4\u05de\u05d7\u05e9\u05d1. <\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\u05d7\u05d5\u05e5 \u05de\u05d4\u05e9\u05e2\u05d5\u05df.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\u05d9\u05d5\u05dd \u05d0\u05d7\u05d3 \u05d0\u05db\u05ea\u05d5\u05d1 \u05e4\u05d5\u05e1\u05d8 \u05e2\u05dc Date (\u05d4\u05d1\u05e0\u05ea\u05dd? \u05d9\u05d5\u05dd \u05d0\u05d7\u05d3? Date?), \u05d0\u05d1\u05dc \u05d1\u05d9\u05e0\u05ea\u05d9\u05d9\u05dd \u05e0\u05e1\u05ea\u05e4\u05e7 \u05d1\u05e4\u05d5\u05e0\u05e7\u05e6\u05d9\u05d4 \u05d4\u05d6\u05d0\u05ea:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>Date.now()<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">\u05d6\u05d0\u05ea \u05e4\u05d5\u05e0\u05e7\u05e6\u05d9\u05d4 \u05e9\u05de\u05d7\u05d6\u05d9\u05e8\u05d4 \u05d0\u05ea \u05d4\u05ea\u05d0\u05e8\u05d9\u05da \u05d4\u05e0\u05d5\u05db\u05d7\u05d9 \u05d1\u05e6\u05d5\u05e8\u05d4 \u05e9\u05dc \u05d0\u05dc\u05e4\u05d9\u05d5\u05ea \u05d4\u05e9\u05e0\u05d9\u05d4, \u05db\u05d0\u05e9\u05e8 \u05ea\u05d0\u05e8\u05d9\u05da \u05d4\u05d1\u05e1\u05d9\u05e1 \u05d4\u05d5\u05d0 1970.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\u05d7\u05e9\u05d1\u05ea\u05d9 \u05dc\u05e2\u05e6\u05de\u05d9 &quot;\u05de\u05d4 \u05d9\u05e7\u05e8\u05d4 \u05d0\u05dd \u05d0\u05d3\u05d2\u05d5\u05dd \u05d0\u05ea \u05d4\u05d6\u05de\u05df \u05d4\u05e0\u05d5\u05db\u05d7\u05d9 \u05d5\u05d0\u05e7\u05d7 \u05d0\u05ea \u05d4\u05e1\u05d9\u05e4\u05e8\u05d4 \u05d4\u05d0\u05d7\u05e8\u05d5\u05e0\u05d4?&quot;<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\u05d1\u05d5\u05d0\u05d5 \u05e0\u05d7\u05dc\u05e5 \u05d0\u05ea \u05d4\u05e1\u05d9\u05e4\u05e8\u05d4 \u05d4\u05d0\u05d7\u05e8\u05d5\u05e0\u05d4 \u05de\u05de\u05e1\u05e4\u05e8 \u05d0\u05e8\u05d5\u05da. \u05d9\u05e9 \u05db\u05dc \u05de\u05d9\u05e0\u05d9 \u05d8\u05e8\u05d9\u05e7\u05d9\u05dd \u05dc\u05e2\u05e9\u05d5\u05ea \u05d0\u05ea \u05d6\u05d4. \u05d0\u05e0\u05d9 \u05d0\u05de\u05d9\u05e8 \u05d0\u05ea \u05d4\u05de\u05e1\u05e4\u05e8 \u05dc\u05de\u05d7\u05e8\u05d5\u05d6\u05ea, \u05d0\u05de\u05e9\u05d5\u05da \u05d0\u05ea \u05d4\u05ea\u05d5 \u05d4\u05d0\u05d7\u05e8\u05d5\u05df \u05d5\u05d0\u05de\u05d9\u05e8 \u05d1\u05d7\u05d6\u05e8\u05d4 \u05dc\u05de\u05e1\u05e4\u05e8.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>function getLastDigitOfNow() {\n  const str = Date.now().toString()\n  const lastChar = str.substr(str.length - 1)\n  return Number(lastChar)\n}<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">\u05dc\u05db\u05d0\u05d5\u05e8\u05d4 \u05d4\u05db\u05dc \u05e4\u05e9\u05d5\u05d8, \u05d0\u05d1\u05dc \u05d4\u05d1\u05d3\u05d9\u05e7\u05d4 \u05e9\u05dc \u05d4\u05e4\u05d5\u05e0\u05e7\u05e6\u05d9\u05d4 \u05d4\u05d6\u05d0\u05ea \u05d4\u05d9\u05d0 \u05e7\u05e6\u05ea \u05d8\u05e8\u05d9\u05e7\u05d9\u05ea&#8230; \u05d0\u05d9\u05da \u05de\u05ea\u05d1\u05e7\u05e9 \u05dc\u05d1\u05d3\u05d5\u05e7 \u05d0\u05ea \u05d4\u05e4\u05d5\u05e0\u05e7\u05e6\u05d9\u05d4? \u05dc\u05d4\u05e8\u05d9\u05e5 \u05d0\u05d5\u05ea\u05d4 \u05d1\u05dc\u05d5\u05dc\u05d0\u05d4 \u05d5\u05dc\u05d1\u05d3\u05d5\u05e7 \u05d0\u05ea \u05d4\u05ea\u05e4\u05dc\u05d2\u05d5\u05ea \u05d4\u05ea\u05d5\u05e6\u05d0\u05d5\u05ea. \u05d0\u05dd \u05d4\u05d9\u05d0 \u05e9\u05d5\u05d5\u05d4 \u05de\u05e9\u05d4\u05d5, \u05d1\u05d4\u05e8\u05d1\u05d4 \u05de\u05d0\u05d3 \u05d4\u05e8\u05e6\u05d5\u05ea \u05ea\u05d4\u05d9\u05d4 \u05d4\u05ea\u05e4\u05dc\u05d2\u05d5\u05ea \u05e9\u05d5\u05d5\u05d4 \u05e9\u05dc \u05db\u05dc \u05d4\u05e1\u05e4\u05e8\u05d5\u05ea \u05d1\u05d9\u05df 0-9. \u05d4\u05d1\u05e2\u05d9\u05d4 \u05d4\u05d9\u05d0 \u05e9\u05dc\u05d5\u05dc\u05d0\u05d5\u05ea \u05e0\u05d5\u05e2\u05dc\u05d5\u05ea \u05d0\u05ea \u05d4\u05d4\u05ea\u05e7\u05d3\u05de\u05d5\u05ea \u05e9\u05dc \u05d4\u05e7\u05d5\u05d3 \u05d5\u05d0\u05d6 \u05d9\u05d5\u05e6\u05d0 \u05de\u05e9\u05d4\u05d5 \u05de\u05d0\u05d3 \u05de\u05d5\u05d6\u05e8. \u05db\u05d0\u05e9\u05e8 \u05de\u05e8\u05d9\u05e6\u05d9\u05dd \u05d0\u05ea \u05d4\u05e4\u05d5\u05e0\u05e7\u05e6\u05d9\u05d4 \u05de\u05ea\u05e7\u05d1\u05dc \u05e8\u05e7 \u05de\u05e1\u05e4\u05e8 \u05d0\u05d7\u05d3 \u05e2\u05d1\u05d5\u05e8 \u05db\u05dc \u05d4\u05ea\u05d5\u05e6\u05d0\u05d5\u05ea! \u05d0\u05dc \u05d3\u05d0\u05d2\u05d4, \u05d9\u05e9 \u05e4\u05ea\u05e8\u05d5\u05df. \u05d1\u05de\u05e7\u05d5\u05dd \u05dc\u05d4\u05e8\u05d9\u05e5 \u05d1\u05e8\u05e6\u05e3, \u05e0\u05e9\u05ea\u05de\u05e9 \u05d1\u05d8\u05d9\u05d9\u05de\u05e8.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>const a = &#91;]\n\nfunction addTo() {\n  a.push(getLastDigitOfNow())\n  \n  if (a.length &lt; 100) {\n    setTimeout(() =&gt; addTo(), 10) \/\/ Math.min(10, a.length))\n  } else {\n    console.log(a)\n  }\n}<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">\u05e2\u05d3 \u05db\u05d0\u05df \u05e0\u05e8\u05d0\u05d4 \u05d1\u05e1\u05d3\u05e8.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\u05d0\u05d1\u05dc \u05d1\u05d5\u05d0\u05d5 \u05e0\u05e1\u05ea\u05db\u05dc \u05e2\u05dc \u05d4\u05ea\u05d5\u05e6\u05d0\u05d4 \u05d1\u05e4\u05d5\u05e2\u05dc. \u05d5\u05e0\u05e9\u05d9\u05dd \u05d0\u05d5\u05ea\u05d4 \u05de\u05d5\u05dc \u05d4\u05e8\u05e6\u05d4 \u05e9\u05dc \u05e4\u05d5\u05e0\u05e7\u05e6\u05d9\u05d4 \u05d0\u05e7\u05e8\u05d0\u05d9\u05ea \u05e1\u05d8\u05e0\u05d3\u05e8\u05d8\u05d9\u05ea \u05db\u05de\u05d5 \u05d1\u05ea\u05d7\u05d9\u05dc\u05ea \u05d4\u05de\u05d0\u05de\u05e8.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\u05d6\u05d0\u05ea \u05d4\u05ea\u05d5\u05e6\u05d0\u05d4 \u05d4\u05e1\u05d8\u05e0\u05d3\u05e8\u05d8\u05d9\u05ea:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>&#91;8,3,0,2,8,2,9,0,3,5,1,7,5,9,4,2,0,3,9,4,4,8,2,5,2,5,9,5,4,6,9,4,2,8,7,4,9,0,6,2,8,8,8,2,1,1,3,9,4,5,2,8,0,9,9,6,5,1,3,2,6,1,2,0,4,0,6,3,3,4,1,9,3,9,0,6,3,9,2,4,4,8,3,1,1,6,3,9,5,3,6,0,5,2,0,4,0,7,4,1]<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">\u05d6\u05d0\u05ea \u05d4\u05ea\u05d5\u05e6\u05d0\u05d4 \u05e9\u05dc \u05e4\u05d5\u05e0\u05e7\u05e6\u05d9\u05d9\u05ea \u05d4\u05d8\u05d9\u05d9\u05de\u05e8:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>&#91;0,6,9,6,5,6,1,5,6,5,9,9,6,4,5,5,6,1,5,6,6,5,0,6,5,5,5,6,6,6,5,1,5,5,5,5,4,5,5,7,5,5,6,5,9,4,5,5,5,5,5,5,6,5,5,5,5,5,5,5,6,7,6,6,7,7,8,5,5,6,6,5,6,6,6,8,6,5,6,6,6,0,5,6,6,6,6,5,6,5,6,5,6,6,7,6,6,7,5,6]<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">\u05de\u05e9\u05d4\u05d5 \u05e0\u05e8\u05d0\u05d4 \u05db\u05d0\u05df \u05e9\u05d5\u05e0\u05d4, \u05e0\u05db\u05d5\u05df? \u05d4\u05de\u05d5\u05df \u05de\u05e1\u05e4\u05e8\u05d9\u05dd \u05d7\u05d5\u05d6\u05e8\u05d9\u05dd \u05e2\u05dc \u05e2\u05e6\u05de\u05dd \u05d1\u05e8\u05e6\u05e3. \u05dc\u05de\u05d4?<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\u05d4\u05e1\u05d9\u05d1\u05d4 \u05d4\u05d9\u05d0 \u05e9\u05d4\u05d8\u05d9\u05d9\u05de\u05e8 \u05de\u05ea\u05e0\u05d4\u05d2 \u05d1\u05e6\u05d5\u05e8\u05d4 \u05e6\u05e4\u05d5\u05d9\u05d4. \u05d0\u05dd \u05d0\u05d7\u05ea \u05dc\u05db\u05de\u05d4 \u05e8\u05d2\u05e2\u05d9\u05dd \u05d4\u05d5\u05d0 \u05d3\u05d5\u05d2\u05dd \u05d0\u05ea \u05d4\u05e9\u05e2\u05d5\u05df, \u05d4\u05e8\u05d9 \u05e9\u05d0\u05dd \u05d4\u05db\u05dc \u05de\u05d5\u05e9\u05dc\u05dd \u05d4\u05d5\u05d0 \u05d9\u05d3\u05d2\u05d5\u05dd \u05d0\u05ea \u05d4\u05e9\u05e2\u05d5\u05df \u05d1\u05d6\u05de\u05e0\u05d9\u05dd \u05e6\u05e4\u05d5\u05d9\u05d9\u05dd \u05dc\u05d2\u05de\u05e8\u05d9, \u05de\u05d4 \u05e9\u05d9\u05d9\u05e6\u05e8 \u05ea\u05d1\u05e0\u05d9\u05ea \u05e9\u05dc \u05ea\u05d5\u05e6\u05d0\u05d5\u05ea. \u05d0\u05e0\u05d9 \u05d7\u05d5\u05d6\u05e8 \u05d5\u05de\u05d3\u05d2\u05d9\u05e9: \u05d6\u05d0\u05ea \u05d1\u05e2\u05d9\u05d4 \u05e9\u05dc \u05d4\u05d3\u05e8\u05da \u05e9\u05d1\u05d4 \u05d0\u05e0\u05d7\u05e0\u05d5 \u05d1\u05d5\u05d3\u05e7\u05d9\u05dd, \u05dc\u05d0 \u05d4\u05e7\u05d5\u05e0\u05e1\u05e4\u05d8 \u05e2\u05e6\u05de\u05d5! \u05d5\u05e2\u05d3\u05d9\u05d9\u05df \u05d9\u05e9 \u05de\u05d4 \u05dc\u05e2\u05e9\u05d5\u05ea. \u05d0\u05e4\u05e9\u05e8 \u05dc\u05d3\u05d2\u05d5\u05dd \u05d0\u05ea \u05d4\u05d6\u05de\u05df \u05d0\u05d7\u05ea \u05dc\u05d6\u05de\u05df \u05de\u05e9\u05ea\u05e0\u05d4. \u05d0\u05e4\u05e9\u05e8 \u05dc\u05e9\u05e0\u05d5\u05ea \u05d0\u05ea \u05d4\u05d8\u05d9\u05d9\u05de\u05e8 \u05dc\u05e4\u05d9 \u05d0\u05d5\u05e8\u05da \u05d4\u05de\u05d7\u05e8\u05d5\u05d6\u05ea. \u05d6\u05d4 \u05d9\u05d9\u05e6\u05e8 \u05e4\u05d5\u05e0\u05e7\u05e6\u05d9\u05d4 \u05d0\u05d9\u05d8\u05d9\u05ea \u05de\u05d0\u05d3. \u05d0\u05d1\u05dc \u05d0\u05e4\u05e9\u05e8 \u05dc\u05e0\u05e1\u05d5\u05ea \u05d8\u05e8\u05d9\u05e7\u05d9\u05dd \u05d0\u05d7\u05e8\u05d9\u05dd. \u05dc\u05d3\u05d5\u05d2\u05de\u05d4, \u05dc\u05e7\u05d1\u05d5\u05e2 \u05d0\u05ea \u05d4\u05d0\u05d9\u05e0\u05d8\u05e8\u05d5\u05d5\u05dc \u05d4\u05d1\u05d0 \u05e2\u05dc \u05d1\u05e1\u05d9\u05e1 \u05d4\u05de\u05e1\u05e4\u05e8 \u05e9\u05d4\u05ea\u05e7\u05d1\u05dc. \u05d4\u05e0\u05d4 \u05dc\u05db\u05dd \u05ea\u05e8\u05d2\u05d9\u05dc \u05de\u05d7\u05e9\u05d1\u05ea\u05d9: \u05de\u05d4 \u05d0\u05e4\u05e9\u05e8 \u05dc\u05e2\u05e9\u05d5\u05ea \u05d1\u05e9\u05d1\u05d9\u05dc \u05dc\u05d4\u05d2\u05d1\u05d9\u05e8 \u05d0\u05ea \u05d4\u05d0\u05e7\u05e8\u05d0\u05d9\u05d5\u05ea \u05e9\u05dc \u05d4\u05ea\u05d5\u05e6\u05d0\u05d5\u05ea?<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\u05d0\u05dd \u05d0\u05ea\u05dd \u05e8\u05d5\u05e6\u05d9\u05dd \u05dc\u05d3\u05e2\u05ea \u05d0\u05ea \u05d4\u05ea\u05e4\u05dc\u05d2\u05d5\u05ea \u05d4\u05ea\u05d5\u05e6\u05d0\u05d5\u05ea \u05e9\u05dc\u05db\u05dd, \u05d0\u05e4\u05e9\u05e8 \u05dc\u05d4\u05e9\u05ea\u05de\u05e9 \u05d1\u05e4\u05d5\u05e0\u05e7\u05e6\u05d9\u05d4 \u05e9\u05dc <a href=\"https:\/\/lodash.com\/docs\/4.17.15#countBy\" data-type=\"URL\" data-id=\"https:\/\/lodash.com\/docs\/4.17.15#countBy\" target=\"_blank\" rel=\"noreferrer noopener\">Lodash<\/a>:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>_.countBy(array, Math.floor)<\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\">\u05dc\u05e1\u05d9\u05db\u05d5\u05dd<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">\u05ea\u05de\u05d9\u05d3 \u05e0\u05d7\u05de\u05d3 \u05dc\u05dc\u05de\u05d5\u05d3 \u05e2\u05dc \u05e4\u05ea\u05e8\u05d5\u05e0\u05d5\u05ea \u05de\u05e7\u05d5\u05d1\u05dc\u05d9\u05dd \u05dc\u05d1\u05e2\u05d9\u05d5\u05ea \u05de\u05d5\u05db\u05e8\u05d5\u05ea. \u05d0\u05d1\u05dc \u05d4\u05e8\u05d1\u05d4 \u05d9\u05d5\u05ea\u05e8 \u05de\u05e2\u05e0\u05d9\u05d9\u05df \u05dc\u05d4\u05e9\u05ea\u05de\u05e9 \u05d1\u05d6\u05d4 \u05d1\u05ea\u05d5\u05e8 \u05e7\u05e8\u05e9 \u05e7\u05e4\u05d9\u05e6\u05d4 \u05d1\u05e9\u05d1\u05d9\u05dc \u05dc\u05d4\u05e4\u05e2\u05d9\u05dc \u05d0\u05ea \u05d4\u05de\u05d5\u05d7 \u05d5\u05dc\u05d7\u05e9\u05d5\u05d1 \u05d9\u05e6\u05d9\u05e8\u05ea\u05d9.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\u05d6\u05d4 \u05d4\u05d9\u05d4 \u05de\u05d0\u05de\u05e8 \u05d0\u05e8\u05d5\u05da \u05e2\u05dd \u05d4\u05e8\u05d1\u05d4 \u05e7\u05d5\u05d3 \u05d5\u05d1\u05dc\u05d9 \u05d0\u05e3 \u05ea\u05de\u05d5\u05e0\u05d4.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\u05d0\u05d6 \u05d4\u05e0\u05d4 \u05ea\u05de\u05d5\u05e0\u05d4 \u05e9\u05dc\u05da \u05d0\u05dd \u05d0\u05ea\\\u05d4 \u05de\u05e4\u05ea\u05d7\\\u05ea \u05e1\u05d9\u05e0\u05d9\u05d5\u05e8\\\u05d9\u05d8\u05d4 \u05d5\u05dc\u05d0 \u05d7\u05d9\u05d3\u05e9\u05ea\u05d9 \u05dc\u05da \u05db\u05dc\u05d5\u05dd.<\/p>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter size-large\"><img fetchpriority=\"high\" decoding=\"async\" width=\"320\" height=\"414\" src=\"https:\/\/gilsteiner.com\/loragil\/wp-content\/uploads\/2021\/04\/pexels-arindam-raha-2213575.jpg\" alt=\"\" class=\"wp-image-698\" srcset=\"https:\/\/gilsteiner.com\/loragil\/wp-content\/uploads\/2021\/04\/pexels-arindam-raha-2213575.jpg 320w, https:\/\/gilsteiner.com\/loragil\/wp-content\/uploads\/2021\/04\/pexels-arindam-raha-2213575-232x300.jpg 232w\" sizes=\"(max-width: 320px) 100vw, 320px\" \/><\/figure><\/div>\n","protected":false},"excerpt":{"rendered":"<p>\u05dc\u05de\u05e1\u05e4\u05e8\u05d9\u05dd \u05d0\u05e7\u05e8\u05d0\u05d9\u05d9\u05dd \u05d9\u05e9 \u05dc\u05d2\u05e9\u05ea \u05d1\u05e6\u05d5\u05e8\u05d4 \u05de\u05ea\u05d5\u05db\u05e0\u05e0\u05ea. \u05dc\u05d3\u05d5\u05d2\u05de\u05d4 \u05db\u05db\u05d4.<\/p>\n","protected":false},"author":1,"featured_media":46,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_crdt_document":"","ocean_post_layout":"","ocean_both_sidebars_style":"","ocean_both_sidebars_content_width":0,"ocean_both_sidebars_sidebars_width":0,"ocean_sidebar":"0","ocean_second_sidebar":"0","ocean_disable_margins":"enable","ocean_add_body_class":"","ocean_shortcode_before_top_bar":"","ocean_shortcode_after_top_bar":"","ocean_shortcode_before_header":"","ocean_shortcode_after_header":"","ocean_has_shortcode":"","ocean_shortcode_after_title":"","ocean_shortcode_before_footer_widgets":"","ocean_shortcode_after_footer_widgets":"","ocean_shortcode_before_footer_bottom":"","ocean_shortcode_after_footer_bottom":"","ocean_display_top_bar":"default","ocean_display_header":"default","ocean_header_style":"","ocean_center_header_left_menu":"0","ocean_custom_header_template":"0","ocean_custom_logo":0,"ocean_custom_retina_logo":0,"ocean_custom_logo_max_width":0,"ocean_custom_logo_tablet_max_width":0,"ocean_custom_logo_mobile_max_width":0,"ocean_custom_logo_max_height":0,"ocean_custom_logo_tablet_max_height":0,"ocean_custom_logo_mobile_max_height":0,"ocean_header_custom_menu":"0","ocean_menu_typo_font_family":"0","ocean_menu_typo_font_subset":"","ocean_menu_typo_font_size":0,"ocean_menu_typo_font_size_tablet":0,"ocean_menu_typo_font_size_mobile":0,"ocean_menu_typo_font_size_unit":"px","ocean_menu_typo_font_weight":"","ocean_menu_typo_font_weight_tablet":"","ocean_menu_typo_font_weight_mobile":"","ocean_menu_typo_transform":"","ocean_menu_typo_transform_tablet":"","ocean_menu_typo_transform_mobile":"","ocean_menu_typo_line_height":0,"ocean_menu_typo_line_height_tablet":0,"ocean_menu_typo_line_height_mobile":0,"ocean_menu_typo_line_height_unit":"","ocean_menu_typo_spacing":0,"ocean_menu_typo_spacing_tablet":0,"ocean_menu_typo_spacing_mobile":0,"ocean_menu_typo_spacing_unit":"","ocean_menu_link_color":"","ocean_menu_link_color_hover":"","ocean_menu_link_color_active":"","ocean_menu_link_background":"","ocean_menu_link_hover_background":"","ocean_menu_link_active_background":"","ocean_menu_social_links_bg":"","ocean_menu_social_hover_links_bg":"","ocean_menu_social_links_color":"","ocean_menu_social_hover_links_color":"","ocean_disable_title":"default","ocean_disable_heading":"default","ocean_post_title":"","ocean_post_subheading":"","ocean_post_title_style":"","ocean_post_title_background_color":"","ocean_post_title_background":0,"ocean_post_title_bg_image_position":"","ocean_post_title_bg_image_attachment":"","ocean_post_title_bg_image_repeat":"","ocean_post_title_bg_image_size":"","ocean_post_title_height":0,"ocean_post_title_bg_overlay":0.5,"ocean_post_title_bg_overlay_color":"","ocean_disable_breadcrumbs":"default","ocean_breadcrumbs_color":"","ocean_breadcrumbs_separator_color":"","ocean_breadcrumbs_links_color":"","ocean_breadcrumbs_links_hover_color":"","ocean_display_footer_widgets":"default","ocean_display_footer_bottom":"default","ocean_custom_footer_template":"0","ocean_post_oembed":"","ocean_post_self_hosted_media":"","ocean_post_video_embed":"","ocean_link_format":"","ocean_link_format_target":"self","ocean_quote_format":"","ocean_quote_format_link":"post","ocean_gallery_link_images":"off","ocean_gallery_id":[],"footnotes":""},"categories":[13],"tags":[],"class_list":["post-161","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-13","entry","has-media"],"_links":{"self":[{"href":"https:\/\/gilsteiner.com\/loragil\/wp-json\/wp\/v2\/posts\/161","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/gilsteiner.com\/loragil\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/gilsteiner.com\/loragil\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/gilsteiner.com\/loragil\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/gilsteiner.com\/loragil\/wp-json\/wp\/v2\/comments?post=161"}],"version-history":[{"count":10,"href":"https:\/\/gilsteiner.com\/loragil\/wp-json\/wp\/v2\/posts\/161\/revisions"}],"predecessor-version":[{"id":718,"href":"https:\/\/gilsteiner.com\/loragil\/wp-json\/wp\/v2\/posts\/161\/revisions\/718"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/gilsteiner.com\/loragil\/wp-json\/wp\/v2\/media\/46"}],"wp:attachment":[{"href":"https:\/\/gilsteiner.com\/loragil\/wp-json\/wp\/v2\/media?parent=161"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/gilsteiner.com\/loragil\/wp-json\/wp\/v2\/categories?post=161"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/gilsteiner.com\/loragil\/wp-json\/wp\/v2\/tags?post=161"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}