{"id":1034,"date":"2010-03-09T09:42:14","date_gmt":"2010-03-09T16:42:14","guid":{"rendered":"https:\/\/onebitpixel.com\/aml\/?p=1034"},"modified":"2010-03-09T09:42:14","modified_gmt":"2010-03-09T16:42:14","slug":"flash-as3-random-lowhigh","status":"publish","type":"post","link":"https:\/\/onebitpixel.com\/aml\/?p=1034","title":{"rendered":"Flash AS3: Random Low\/High"},"content":{"rendered":"<p>\/\/call this function, pass it two numbers (low number, high number)<br \/>\n\/\/ should return a random number between lo and high number<br \/>\n\/\/ some error checking,\u00c2\u00a0 checks to see if low number &lt; high number<\/p>\n<p>function randomNumber(low:Number=NaN, high:Number=NaN):Number {<\/p>\n<p>var low:Number=low;<br \/>\nvar high:Number=high;<\/p>\n<p>if (isNaN(low)) {<br \/>\nthrow new Error(&#8220;low must be defined&#8221;);<br \/>\n}<\/p>\n<p>if (isNaN(high)) {<br \/>\nthrow new Error(&#8220;high must be defined&#8221;);<br \/>\n}<\/p>\n<p>if (low&gt;high) {<br \/>\nthrow new Error(&#8220;low number must be less then high number&#8221;);<br \/>\n}<\/p>\n<p>return Math.round(Math.random() * (high &#8211; low)) + low;<\/p>\n<p>}<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\/\/call this function, pass it two numbers (low number, high number) \/\/ should return a random number between lo and high number \/\/ some error checking,\u00c2\u00a0 checks to see if low number &lt; high number function randomNumber(low:Number=NaN, high:Number=NaN):Number { var [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[75],"tags":[4,114,113],"class_list":["post-1034","post","type-post","status-publish","format-standard","hentry","category-tutorials","tag-actionscript","tag-code","tag-flash"],"_links":{"self":[{"href":"https:\/\/onebitpixel.com\/aml\/index.php?rest_route=\/wp\/v2\/posts\/1034","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/onebitpixel.com\/aml\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/onebitpixel.com\/aml\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/onebitpixel.com\/aml\/index.php?rest_route=\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/onebitpixel.com\/aml\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=1034"}],"version-history":[{"count":1,"href":"https:\/\/onebitpixel.com\/aml\/index.php?rest_route=\/wp\/v2\/posts\/1034\/revisions"}],"predecessor-version":[{"id":1035,"href":"https:\/\/onebitpixel.com\/aml\/index.php?rest_route=\/wp\/v2\/posts\/1034\/revisions\/1035"}],"wp:attachment":[{"href":"https:\/\/onebitpixel.com\/aml\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1034"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/onebitpixel.com\/aml\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=1034"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/onebitpixel.com\/aml\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=1034"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}