{"id":25,"date":"2008-05-14T13:20:00","date_gmt":"2008-05-14T18:20:00","guid":{"rendered":"http:\/\/thaylin.info\/blog\/?p=25"},"modified":"2009-02-10T12:04:28","modified_gmt":"2009-02-10T17:04:28","slug":"oh-the-randomness","status":"publish","type":"post","link":"https:\/\/www.thaylin.com\/blog\/2008\/05\/14\/oh-the-randomness\/","title":{"rendered":"oh the randomness"},"content":{"rendered":"<pre lang=\"actionscript\" line=\"1\" colla=\"+\">\r\nprivate function randomSort(a:*, b:*):Number\r\n{\r\n            return Math.random()>.5 ? -1 : 1;\r\n}\r\nprivate function myFunc():void\r\n{\r\n             var myArrayToSort = [1,2,3,4,5];\r\n            myArrayToSort.sort(randomSort);\r\n             trace(MY ARRAY SORTED IS '+myArrayToSort)\r\n}\r\n<\/pre>\n<p>Awesome way to randomly sort an array.<br \/>\nI&#8217;m using this with the sliver movie to randomly place the clips in various positions so every time you watch the movie it&#8217;s different.<br \/>\nPretty damned cool.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>private function randomSort(a:*, b:*):Number { return Math.random()>.5 ? -1 : 1; } private function myFunc():void { var myArrayToSort = [1,2,3,4,5]; myArrayToSort.sort(randomSort); trace(MY ARRAY SORTED IS &#8216;+myArrayToSort) } Awesome way to randomly sort an array. I&#8217;m using this with the sliver movie to randomly place the clips in various positions so every time you watch the [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[11,9,8],"tags":[],"_links":{"self":[{"href":"https:\/\/www.thaylin.com\/blog\/wp-json\/wp\/v2\/posts\/25"}],"collection":[{"href":"https:\/\/www.thaylin.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.thaylin.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.thaylin.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.thaylin.com\/blog\/wp-json\/wp\/v2\/comments?post=25"}],"version-history":[{"count":1,"href":"https:\/\/www.thaylin.com\/blog\/wp-json\/wp\/v2\/posts\/25\/revisions"}],"predecessor-version":[{"id":118,"href":"https:\/\/www.thaylin.com\/blog\/wp-json\/wp\/v2\/posts\/25\/revisions\/118"}],"wp:attachment":[{"href":"https:\/\/www.thaylin.com\/blog\/wp-json\/wp\/v2\/media?parent=25"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.thaylin.com\/blog\/wp-json\/wp\/v2\/categories?post=25"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.thaylin.com\/blog\/wp-json\/wp\/v2\/tags?post=25"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}