{"id":112,"date":"2008-06-04T10:18:44","date_gmt":"2008-06-04T09:18:44","guid":{"rendered":"http:\/\/www.ozone3d.net\/blogs\/lab\/?p=112"},"modified":"2008-06-04T11:00:44","modified_gmt":"2008-06-04T10:00:44","slug":"better-smaller-and-faster-random-number-generator","status":"publish","type":"post","link":"https:\/\/www.ozone3d.net\/blogs\/lab\/20080604\/better-smaller-and-faster-random-number-generator\/","title":{"rendered":"Better, smaller and faster random number generator"},"content":{"rendered":"<p>I found this cool random generator on rgba&#8217;s website. <b>rgba<\/b> is a wellknown demoscene group specialized in 4k prods. This random generator is used in their prods:<\/p>\n<pre>\r\nstatic unsigned int mirand = 1;\r\nfloat sfrand( void )\r\n{\r\n    unsigned int a;\r\n    mirand *= 16807;\r\n    a = (mirand&0x007fffff) | 0x40000000;\r\n    return( *((float*)&a) - 3.0f );\r\n}\r\n<\/pre>\n<p>It produces values in the range [-1.0; 1.0].<\/p>\n<p>You can find the making of this random gen <a href=\"http:\/\/rgba.scenesp.org\/articles\/sfrand\/sfrand.htm\">HERE<\/a>.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>I found this cool random generator on rgba&#8217;s website. rgba is a wellknown demoscene group specialized in 4k prods. This random generator is used in their prods: static unsigned int mirand = 1; float sfrand( void ) { unsigned int a; mirand *= 16807; a = (mirand&#038;0x007fffff) | 0x40000000; return( *((float*)&#038;a) &#8211; 3.0f ); } It produces values in the range [-1.0; 1.0]. You can &hellip; <a href=\"https:\/\/www.ozone3d.net\/blogs\/lab\/20080604\/better-smaller-and-faster-random-number-generator\/\" class=\"more-link\">Continue reading <span class=\"screen-reader-text\">Better, smaller and faster random number generator<\/span> <span class=\"meta-nav\">&raquo;<\/span><\/a><\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[8],"tags":[295,637,296],"class_list":["post-112","post","type-post","status-publish","format-standard","hentry","category-programming","tag-cc","tag-programming","tag-random-generator"],"aioseo_notices":[],"views":1248,"_links":{"self":[{"href":"https:\/\/www.ozone3d.net\/blogs\/lab\/wp-json\/wp\/v2\/posts\/112","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.ozone3d.net\/blogs\/lab\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.ozone3d.net\/blogs\/lab\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.ozone3d.net\/blogs\/lab\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.ozone3d.net\/blogs\/lab\/wp-json\/wp\/v2\/comments?post=112"}],"version-history":[{"count":0,"href":"https:\/\/www.ozone3d.net\/blogs\/lab\/wp-json\/wp\/v2\/posts\/112\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.ozone3d.net\/blogs\/lab\/wp-json\/wp\/v2\/media?parent=112"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.ozone3d.net\/blogs\/lab\/wp-json\/wp\/v2\/categories?post=112"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.ozone3d.net\/blogs\/lab\/wp-json\/wp\/v2\/tags?post=112"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}