{"id":115,"date":"2008-12-06T00:00:16","date_gmt":"2008-12-06T07:00:16","guid":{"rendered":"https:\/\/actionsnippet.com\/?p=300"},"modified":"2008-12-06T00:00:16","modified_gmt":"2008-12-06T07:00:16","slug":"random-walk","status":"publish","type":"post","link":"https:\/\/actionsnippet.com\/?p=115","title":{"rendered":"Random Walk"},"content":{"rendered":"<pre class=\"brush: as3; title: ; notranslate\" title=\"\">\r\nvar xp:Number=Math.random() * stage.stageWidth;\r\nvar yp:Number=Math.random() * stage.stageHeight;\r\ngraphics.lineStyle(0,0x000000);\r\ngraphics.moveTo(xp, yp);\r\naddEventListener(Event.ENTER_FRAME, onLoop);\r\nfunction onLoop(evt:Event):void {\r\n\txp+=Math.random()*10-5;\r\n\typ+=Math.random()*10-5;\r\n\tgraphics.lineTo(xp, yp);\r\n}\r\n<\/pre>\n<p>Nothing special here, but its good to know that this technique has a name&#8230; and that it&#8217;s NOT Brownian Motion&#8230; <a href=\"http:\/\/en.wikipedia.org\/wiki\/Random_walk\">more here.<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>var xp:Number=Math.random() * stage.stageWidth; var yp:Number=Math.random() * stage.stageHeight; graphics.lineStyle(0,0&#215;000000); graphics.moveTo(xp, yp); addEventListener(Event.ENTER_FRAME, onLoop); function onLoop(evt:Event):void { xp+=Math.random()*10-5; yp+=Math.random()*10-5; graphics.lineTo(xp, yp); } Nothing special here, but its good to know that this technique has a name&#8230; and that it&#8217;s NOT Brownian Motion&#8230; more here.<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[33,13],"tags":[3,4,86],"class_list":["post-115","post","type-post","status-publish","format-standard","hentry","category-graphics","category-motion","tag-actionscript","tag-flash","tag-random-walk"],"_links":{"self":[{"href":"https:\/\/actionsnippet.com\/index.php?rest_route=\/wp\/v2\/posts\/115","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/actionsnippet.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/actionsnippet.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/actionsnippet.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/actionsnippet.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=115"}],"version-history":[{"count":0,"href":"https:\/\/actionsnippet.com\/index.php?rest_route=\/wp\/v2\/posts\/115\/revisions"}],"wp:attachment":[{"href":"https:\/\/actionsnippet.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=115"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/actionsnippet.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=115"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/actionsnippet.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=115"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}