{"id":122,"date":"2018-10-02T09:00:38","date_gmt":"2018-10-02T07:00:38","guid":{"rendered":"https:\/\/data-samurai.ch\/?p=122"},"modified":"2020-05-12T18:39:34","modified_gmt":"2020-05-12T16:39:34","slug":"python-random-numbers","status":"publish","type":"post","link":"https:\/\/rel01.data-samurai.ch\/?p=122","title":{"rendered":"Python random numbers"},"content":{"rendered":"\n<figure class=\"wp-block-image\"><img loading=\"lazy\" width=\"1880\" height=\"1253\" src=\"https:\/\/rel01.data-samurai.ch\/wp-content\/uploads\/2018\/10\/roll-the-dice-craps-board-game-points-122427.jpeg\" alt=\"\" class=\"wp-image-123\" srcset=\"https:\/\/rel01.data-samurai.ch\/wp-content\/uploads\/2018\/10\/roll-the-dice-craps-board-game-points-122427.jpeg 1880w, https:\/\/rel01.data-samurai.ch\/wp-content\/uploads\/2018\/10\/roll-the-dice-craps-board-game-points-122427-300x200.jpeg 300w, https:\/\/rel01.data-samurai.ch\/wp-content\/uploads\/2018\/10\/roll-the-dice-craps-board-game-points-122427-768x512.jpeg 768w, https:\/\/rel01.data-samurai.ch\/wp-content\/uploads\/2018\/10\/roll-the-dice-craps-board-game-points-122427-1024x682.jpeg 1024w\" sizes=\"(max-width: 1880px) 100vw, 1880px\" \/><\/figure>\n\n\n\n<p>When I experiment in Python I often need a list of random integers. When I was looking for code to generate that I couldn&#8217;t believe how&nbsp;complicated people are doing that and present it after in their blog. Anyway here are two very easy ways to generate&nbsp;random lists.\n<pre class=\"lang:python decode:true\">import random\n[random.randint(1,100) for i in range(10)]\n#\nimport numpy as np\nnp.random.randint(1,100,10)<\/pre>\n&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>When I experiment in Python I often need a list of random integers. When I was looking for code to generate that I couldn&#8217;t believe how&nbsp;complicated people are doing that and present it after in their blog. Anyway here are two very easy ways to generate&nbsp;random lists. import random [random.randint(1,100) for i in range(10)] # [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":[],"categories":[29,27,28],"tags":[],"_links":{"self":[{"href":"https:\/\/rel01.data-samurai.ch\/index.php?rest_route=\/wp\/v2\/posts\/122"}],"collection":[{"href":"https:\/\/rel01.data-samurai.ch\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/rel01.data-samurai.ch\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/rel01.data-samurai.ch\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/rel01.data-samurai.ch\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=122"}],"version-history":[{"count":4,"href":"https:\/\/rel01.data-samurai.ch\/index.php?rest_route=\/wp\/v2\/posts\/122\/revisions"}],"predecessor-version":[{"id":153,"href":"https:\/\/rel01.data-samurai.ch\/index.php?rest_route=\/wp\/v2\/posts\/122\/revisions\/153"}],"wp:attachment":[{"href":"https:\/\/rel01.data-samurai.ch\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=122"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/rel01.data-samurai.ch\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=122"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/rel01.data-samurai.ch\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=122"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}