{"id":533,"date":"2018-07-23T06:09:46","date_gmt":"2018-07-23T13:09:46","guid":{"rendered":"https:\/\/actionsnippet.com\/?p=3122"},"modified":"2018-07-23T06:09:46","modified_gmt":"2018-07-23T13:09:46","slug":"hermit-crab-curve-as-prng-a-deterministic-pseudo-random-number-generator-with-contrast-and-smoothness-inspired-by-stochastic-and-organic-randomness","status":"publish","type":"post","link":"https:\/\/actionsnippet.com\/?p=533","title":{"rendered":"Hermit Crab Curve as PRNG (a deterministic pseudo-random number generator with contrast and smoothness &#8211; inspired by stochastic and organic randomness)"},"content":{"rendered":"<p>Around 2015 I had the idea for a PRNG that would clamp itself and have moments of &#8220;smoothness&#8221;. When I got around to trying to create such a thing, the result was something I jokingly called the &#8220;Hermit Crab Curve&#8221;. I also called it the &#8220;Shard Curve&#8221;.<\/p>\n<p>The equation for the curve defines a radius in polar coordinates:<\/p>\n<p><img decoding=\"async\" style=\"width:200px\" src=\"https:\/\/actionsnippet.com\/imgs\/hermit.png\" \/><\/p>\n<p>Where <strong>a<\/strong> and <strong>d<\/strong> are paramters that control the detail of the curve. <strong>o<\/strong> is a rotation and offset value for the angle and <strong>s<\/strong> is a scalar. Note the use of <strong>rem<\/strong>. The resulting curve is much less interesting if a standard modulo is used in place of a remainder:<\/p>\n<p><img decoding=\"async\" style=\"width:500px;\" src=\"https:\/\/actionsnippet.com\/imgs\/hermit2.png\" \/><\/p>\n<p>The above variable values were found using this interactive version of the equation:<\/p>\n<p><iframe height='618' scrolling='no' title='Hermit Crab Curve' src='\/\/codepen.io\/ZevanRosser\/embed\/zGNRVz\/?height=618&#038;theme-id=5318&#038;default-tab=result&#038;embed-version=2' frameborder='no' allowtransparency='true' allowfullscreen='true' style='width: 100%;'>See the Pen <a href='https:\/\/codepen.io\/ZevanRosser\/pen\/zGNRVz\/'>Hermit Crab Curve<\/a> by Zevan Rosser (<a href='https:\/\/codepen.io\/ZevanRosser'>@ZevanRosser<\/a>) on <a href='https:\/\/codepen.io'>CodePen<\/a>.<br \/>\n<\/iframe><\/p>\n<p>To illustrate how you might use this as a PRNG I created this fork of the above pen:<\/p>\n<p><iframe height='537' scrolling='no' title='Hermit Crab Curve' src='\/\/codepen.io\/ZevanRosser\/embed\/LeyorL\/?height=537&#038;theme-id=5318&#038;default-tab=result&#038;embed-version=2' frameborder='no' allowtransparency='true' allowfullscreen='true' style='width: 100%;'>See the Pen <a href='https:\/\/codepen.io\/ZevanRosser\/pen\/LeyorL\/'>Hermit Crab Curve<\/a> by Zevan Rosser (<a href='https:\/\/codepen.io\/ZevanRosser'>@ZevanRosser<\/a>) on <a href='https:\/\/codepen.io'>CodePen<\/a>.<br \/>\n<\/iframe><\/p>\n<p>That, in combination with the information from <a href=\"https:\/\/actionsnippet.com\/?p=3102\" target=\"blank\">my other article from yesterday&#8230;<\/a> Should be enough to see what I mean.<\/p>\n<p><img decoding=\"async\" src=\"http:\/\/zevanrosser.com\/arctype-dev\/hermit-crab-grid.jpg\" \/><br \/>\nYou can read the original description of the Hermit Crab Curve that I created using <a href=\"https:\/\/actionsnippet.com\/?p=3033\" target=\"blank\">ArcType<\/a> here:<\/p>\n<p><a href=\"http:\/\/zevanrosser.com\/arctype-dev\/hermit-crab-curve.html\">http:\/\/zevanrosser.com\/arctype-dev\/hermit-crab-curve.html<\/a> <\/p>\n<p>If you end up using this for something interesting let me know. I&#8217;d love to see it \ud83d\ude00<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Around 2015 I had the idea for a PRNG that would clamp itself and have moments of &#8220;smoothness&#8221;. When I got around to trying to create such a thing, the result was something I jokingly called the &#8220;Hermit Crab Curve&#8221;. I also called it the &#8220;Shard Curve&#8221;. The equation for the curve defines a radius [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[17,33,114,160,121,94,13],"tags":[122,170,171],"class_list":["post-533","post","type-post","status-publish","format-standard","hentry","category-functions","category-graphics","category-graphics-algorithms","category-javascript","category-math","category-misc","category-motion","tag-math","tag-prng","tag-random"],"_links":{"self":[{"href":"https:\/\/actionsnippet.com\/index.php?rest_route=\/wp\/v2\/posts\/533","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=533"}],"version-history":[{"count":0,"href":"https:\/\/actionsnippet.com\/index.php?rest_route=\/wp\/v2\/posts\/533\/revisions"}],"wp:attachment":[{"href":"https:\/\/actionsnippet.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=533"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/actionsnippet.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=533"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/actionsnippet.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=533"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}