{"id":215,"date":"2018-12-01T15:30:46","date_gmt":"2018-12-01T06:30:46","guid":{"rendered":"https:\/\/dalomo.net\/blog\/?p=215"},"modified":"2018-12-08T21:52:21","modified_gmt":"2018-12-08T12:52:21","slug":"double%e5%9e%8b%e3%81%a7%e6%8c%87%e5%ae%9a%e3%81%ae%e7%af%84%e5%9b%b2%e3%81%8b%e3%82%89%e3%83%a9%e3%83%b3%e3%83%80%e3%83%a0","status":"publish","type":"post","link":"https:\/\/dalomo.net\/blog\/2018\/12\/01\/215\/","title":{"rendered":"double\u578b\u3067\u6307\u5b9a\u306e\u7bc4\u56f2\u304b\u3089\u30e9\u30f3\u30c0\u30e0"},"content":{"rendered":"<pre class=\"lang-java prettyprint prettyprinted\"><code><span class=\"typ\">Random<\/span><span class=\"pln\"> r <\/span><span class=\"pun\">=<\/span> <span class=\"kwd\">new<\/span> <span class=\"typ\">Random<\/span><span class=\"pun\">();<\/span>\r\n<span class=\"kwd\">double<\/span><span class=\"pln\"> randomValue <\/span><span class=\"pun\">=<\/span><span class=\"pln\"> rangeMin <\/span><span class=\"pun\">+<\/span> <span class=\"pun\">(<\/span><span class=\"pln\">rangeMax <\/span><span class=\"pun\">-<\/span><span class=\"pln\"> rangeMin<\/span><span class=\"pun\">)<\/span> <span class=\"pun\">*<\/span><span class=\"pln\"> r<\/span><span class=\"pun\">.<\/span><span class=\"pln\">nextDouble<\/span><span class=\"pun\">();<\/span><\/code><\/pre>\n<p>\u30c6\u30b9\u30c8<\/p>\n<pre class=\"java\">for (int i = 1 ; i &lt;=5 ; i++){\r\n    Random r = new Random();\r\n    double randomValue = 123.004722 + (145.816278 - 123.004722) * r.nextDouble();\r\n    System.out.println(randomValue);\r\n}<\/pre>\n<p>\u7d50\u679c<\/p>\n<pre><code class=\"stdout ng-binding\">132.99636946543728\r\n134.89191866434484\r\n139.8226971022699\r\n124.47873288915928\r\n142.50470752520263<\/code><\/pre>\n<h3>\u53c2\u8003<\/h3>\n<p><a href=\"https:\/\/stackoverflow.com\/questions\/3680637\/generate-a-random-double-in-a-range\">https:\/\/stackoverflow.com\/questions\/3680637\/generate-a-random-double-in-a-range<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Random r = new Random(); double randomValue = rangeMin + (rangeMax &#8211; rangeMin) * r.nextDouble(); \u30c6\u30b9\u30c8 for (int  &hellip; <a href=\"https:\/\/dalomo.net\/blog\/2018\/12\/01\/215\/\">\u7d9a\u304d\u3092\u8aad\u3080 <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"inline_featured_image":false,"footnotes":""},"categories":[9],"tags":[18,24],"class_list":["post-215","post","type-post","status-publish","format-standard","hentry","category-9","tag-java","tag-24"],"_links":{"self":[{"href":"https:\/\/dalomo.net\/blog\/wp-json\/wp\/v2\/posts\/215","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/dalomo.net\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/dalomo.net\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/dalomo.net\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/dalomo.net\/blog\/wp-json\/wp\/v2\/comments?post=215"}],"version-history":[{"count":1,"href":"https:\/\/dalomo.net\/blog\/wp-json\/wp\/v2\/posts\/215\/revisions"}],"predecessor-version":[{"id":216,"href":"https:\/\/dalomo.net\/blog\/wp-json\/wp\/v2\/posts\/215\/revisions\/216"}],"wp:attachment":[{"href":"https:\/\/dalomo.net\/blog\/wp-json\/wp\/v2\/media?parent=215"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/dalomo.net\/blog\/wp-json\/wp\/v2\/categories?post=215"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/dalomo.net\/blog\/wp-json\/wp\/v2\/tags?post=215"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}