{"id":655,"date":"2017-02-06T22:16:02","date_gmt":"2017-02-07T06:16:02","guid":{"rendered":"http:\/\/www.tech.dimprash.com\/?p=655"},"modified":"2017-02-06T22:16:02","modified_gmt":"2017-02-07T06:16:02","slug":"expand-a-random-range-from-1-5-to-1-7","status":"publish","type":"post","link":"http:\/\/www.tech.dimprash.com\/?p=655","title":{"rendered":"Expand a random range from 1\u20135 to 1\u20137"},"content":{"rendered":"<p><strong>You have a random number generator between 1 and 5. Make a random number between 1 and 7<\/strong><\/p>\n<pre>\r\nint rand7()\r\n{\r\n    int vals[5][5] = {\r\n        { 1, 2, 3, 4, 5 },\r\n        { 6, 7, 1, 2, 3 },\r\n        { 4, 5, 6, 7, 1 },\r\n        { 2, 3, 4, 5, 6 },\r\n        { 7, 0, 0, 0, 0 }\r\n    };\r\n\r\n    int result = 0;\r\n    while (result == 0)\r\n    {\r\n        int i = rand5();\r\n        int j = rand5();\r\n        result = vals[i-1][j-1];\r\n    }\r\n    return result;\r\n}\r\n<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>You have a random number generator between 1 and 5. Make a random number between 1 and 7 int rand7() { int vals[5][5] = { { 1, 2, 3, 4, 5 }, { 6, 7, 1, 2, 3 }, { 4, 5, 6, 7, 1 }, { 2, 3, 4, 5, 6 }, { 7, &hellip; <a href=\"http:\/\/www.tech.dimprash.com\/?p=655\" class=\"more-link\">Continue reading <span class=\"screen-reader-text\">Expand a random range from 1\u20135 to 1\u20137<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[4],"tags":[],"class_list":["post-655","post","type-post","status-publish","format-standard","hentry","category-algorithms"],"_links":{"self":[{"href":"http:\/\/www.tech.dimprash.com\/index.php?rest_route=\/wp\/v2\/posts\/655","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/www.tech.dimprash.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/www.tech.dimprash.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/www.tech.dimprash.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/www.tech.dimprash.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=655"}],"version-history":[{"count":1,"href":"http:\/\/www.tech.dimprash.com\/index.php?rest_route=\/wp\/v2\/posts\/655\/revisions"}],"predecessor-version":[{"id":656,"href":"http:\/\/www.tech.dimprash.com\/index.php?rest_route=\/wp\/v2\/posts\/655\/revisions\/656"}],"wp:attachment":[{"href":"http:\/\/www.tech.dimprash.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=655"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/www.tech.dimprash.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=655"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/www.tech.dimprash.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=655"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}