{"id":1758,"date":"2015-08-05T10:25:15","date_gmt":"2015-08-05T10:25:15","guid":{"rendered":"http:\/\/www.frozax.com\/blog\/?p=1758"},"modified":"2015-08-05T10:25:59","modified_gmt":"2015-08-05T10:25:59","slug":"mersenne-twister-prng-csharp-implementation","status":"publish","type":"post","link":"https:\/\/www.frozax.com\/blog\/2015\/08\/mersenne-twister-prng-csharp-implementation\/","title":{"rendered":"Mersenne Twister PRNG C# implementation"},"content":{"rendered":"<p>I&#8217;m trying Unity 3D and needed a random number generator that would run exactly the same on every platform. I don&#8217;t want to use Unity&#8217;s RNG because I can&#8217;t risk it to change in an update. Therefore, I implemented my own Mersenne Twister implementation in C#. This code is based on the Python implementation of the <a href=\"https:\/\/en.wikipedia.org\/wiki\/Mersenne_Twister\">wikipedia page for Mersenne Twister<\/a>.<\/p>\n<p>The code is available on <a href=\"https:\/\/github.com\/frozax\/misc\/blob\/master\/fgRandom\/fgRandom.cs\">Github here<\/a>.<\/p>\n<div class=\"addtoany_share_save_container addtoany_content_bottom\"><div class=\"a2a_kit a2a_kit_size_32 addtoany_list a2a_target\" id=\"wpa2a_1\"><a class=\"a2a_button_twitter\" href=\"http:\/\/www.addtoany.com\/add_to\/twitter?linkurl=https%3A%2F%2Fwww.frozax.com%2Fblog%2F2015%2F08%2Fmersenne-twister-prng-csharp-implementation%2F&amp;linkname=Mersenne%20Twister%20PRNG%20C%23%20implementation\" title=\"Twitter\" rel=\"nofollow\" target=\"_blank\"><\/a><a class=\"a2a_button_facebook\" href=\"http:\/\/www.addtoany.com\/add_to\/facebook?linkurl=https%3A%2F%2Fwww.frozax.com%2Fblog%2F2015%2F08%2Fmersenne-twister-prng-csharp-implementation%2F&amp;linkname=Mersenne%20Twister%20PRNG%20C%23%20implementation\" title=\"Facebook\" rel=\"nofollow\" target=\"_blank\"><\/a><a class=\"a2a_button_google_plus\" href=\"http:\/\/www.addtoany.com\/add_to\/google_plus?linkurl=https%3A%2F%2Fwww.frozax.com%2Fblog%2F2015%2F08%2Fmersenne-twister-prng-csharp-implementation%2F&amp;linkname=Mersenne%20Twister%20PRNG%20C%23%20implementation\" title=\"Google+\" rel=\"nofollow\" target=\"_blank\"><\/a><a class=\"a2a_button_reddit\" href=\"http:\/\/www.addtoany.com\/add_to\/reddit?linkurl=https%3A%2F%2Fwww.frozax.com%2Fblog%2F2015%2F08%2Fmersenne-twister-prng-csharp-implementation%2F&amp;linkname=Mersenne%20Twister%20PRNG%20C%23%20implementation\" title=\"Reddit\" rel=\"nofollow\" target=\"_blank\"><\/a>\n<script type=\"text\/javascript\"><!--\nwpa2a.script_load();\n\/\/--><\/script>\n<\/div><\/div>","protected":false},"excerpt":{"rendered":"<p>I&#8217;m trying Unity 3D and needed a random number generator that would run exactly the same on every platform. I don&#8217;t want to use Unity&#8217;s RNG because I can&#8217;t risk it to change in an update. Therefore, I implemented my own Mersenne Twister implementation in C#. This code is based on the Python implementation of&hellip; <a class=\"more-link\" href=\"https:\/\/www.frozax.com\/blog\/2015\/08\/mersenne-twister-prng-csharp-implementation\/\">Continue reading <span class=\"screen-reader-text\">Mersenne Twister PRNG C# implementation<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[12],"tags":[],"_links":{"self":[{"href":"https:\/\/www.frozax.com\/blog\/wp-json\/wp\/v2\/posts\/1758"}],"collection":[{"href":"https:\/\/www.frozax.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.frozax.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.frozax.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.frozax.com\/blog\/wp-json\/wp\/v2\/comments?post=1758"}],"version-history":[{"count":1,"href":"https:\/\/www.frozax.com\/blog\/wp-json\/wp\/v2\/posts\/1758\/revisions"}],"predecessor-version":[{"id":1759,"href":"https:\/\/www.frozax.com\/blog\/wp-json\/wp\/v2\/posts\/1758\/revisions\/1759"}],"wp:attachment":[{"href":"https:\/\/www.frozax.com\/blog\/wp-json\/wp\/v2\/media?parent=1758"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.frozax.com\/blog\/wp-json\/wp\/v2\/categories?post=1758"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.frozax.com\/blog\/wp-json\/wp\/v2\/tags?post=1758"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}