<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://glolfwiki.sibr.dev/index.php?action=history&amp;feed=atom&amp;title=Module%3APyrandom</id>
	<title>Module:Pyrandom - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://glolfwiki.sibr.dev/index.php?action=history&amp;feed=atom&amp;title=Module%3APyrandom"/>
	<link rel="alternate" type="text/html" href="https://glolfwiki.sibr.dev/index.php?title=Module:Pyrandom&amp;action=history"/>
	<updated>2026-06-02T20:02:36Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.35.2</generator>
	<entry>
		<id>https://glolfwiki.sibr.dev/index.php?title=Module:Pyrandom&amp;diff=249&amp;oldid=prev</id>
		<title>Pokeylope at 15:31, 11 June 2021</title>
		<link rel="alternate" type="text/html" href="https://glolfwiki.sibr.dev/index.php?title=Module:Pyrandom&amp;diff=249&amp;oldid=prev"/>
		<updated>2021-06-11T15:31:29Z</updated>

		<summary type="html">&lt;p&gt;&lt;/p&gt;
&lt;table class=&quot;diff diff-contentalign-left diff-editfont-monospace&quot; data-mw=&quot;interface&quot;&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;tr class=&quot;diff-title&quot; lang=&quot;en&quot;&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;← Older revision&lt;/td&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;Revision as of 15:31, 11 June 2021&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot; id=&quot;mw-diff-left-l66&quot; &gt;Line 66:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 66:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;	function instance:choice(array)&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;	function instance:choice(array)&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;−&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;		local r = self:_randbelow(#array &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;- 1&lt;/del&gt;)&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;		local r = self:_randbelow(#array)&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;		return array[r + 1]&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;		return array[r + 1]&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;	end&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;	end&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;

&lt;!-- diff cache key my_wiki:diff::1.12:old-210:rev-249 --&gt;
&lt;/table&gt;</summary>
		<author><name>Pokeylope</name></author>
	</entry>
	<entry>
		<id>https://glolfwiki.sibr.dev/index.php?title=Module:Pyrandom&amp;diff=210&amp;oldid=prev</id>
		<title>Pokeylope at 22:16, 3 June 2021</title>
		<link rel="alternate" type="text/html" href="https://glolfwiki.sibr.dev/index.php?title=Module:Pyrandom&amp;diff=210&amp;oldid=prev"/>
		<updated>2021-06-03T22:16:10Z</updated>

		<summary type="html">&lt;p&gt;&lt;/p&gt;
&lt;table class=&quot;diff diff-contentalign-left diff-editfont-monospace&quot; data-mw=&quot;interface&quot;&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;tr class=&quot;diff-title&quot; lang=&quot;en&quot;&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;← Older revision&lt;/td&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;Revision as of 22:16, 3 June 2021&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot; id=&quot;mw-diff-left-l62&quot; &gt;Line 62:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 62:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;		end&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;		end&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;−&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;		return start + self:_randbelow(stop)&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;		return start + self:_randbelow(stop &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;- start&lt;/ins&gt;)&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;	end&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;	end&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;

&lt;!-- diff cache key my_wiki:diff::1.12:old-209:rev-210 --&gt;
&lt;/table&gt;</summary>
		<author><name>Pokeylope</name></author>
	</entry>
	<entry>
		<id>https://glolfwiki.sibr.dev/index.php?title=Module:Pyrandom&amp;diff=209&amp;oldid=prev</id>
		<title>Pokeylope at 21:18, 3 June 2021</title>
		<link rel="alternate" type="text/html" href="https://glolfwiki.sibr.dev/index.php?title=Module:Pyrandom&amp;diff=209&amp;oldid=prev"/>
		<updated>2021-06-03T21:18:13Z</updated>

		<summary type="html">&lt;p&gt;&lt;/p&gt;
&lt;table class=&quot;diff diff-contentalign-left diff-editfont-monospace&quot; data-mw=&quot;interface&quot;&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;tr class=&quot;diff-title&quot; lang=&quot;en&quot;&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;← Older revision&lt;/td&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;Revision as of 21:18, 3 June 2021&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot; id=&quot;mw-diff-left-l1&quot; &gt;Line 1:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 1:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt; &lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;local bit32 = require &amp;quot;bit32&amp;quot;&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;local mt = require &amp;quot;Module:Mt19937ar&amp;quot;&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;local mt = require &amp;quot;Module:Mt19937ar&amp;quot;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;

&lt;!-- diff cache key my_wiki:diff::1.12:old-208:rev-209 --&gt;
&lt;/table&gt;</summary>
		<author><name>Pokeylope</name></author>
	</entry>
	<entry>
		<id>https://glolfwiki.sibr.dev/index.php?title=Module:Pyrandom&amp;diff=208&amp;oldid=prev</id>
		<title>Pokeylope: Created page with &quot;local mt = require &quot;Module:Mt19937ar&quot;  function bit_length(n) 	local l = 0 	while n &gt; 0 do 		l = l + 1 		n = bit32.rshift(n, 1) 	end 	return l end  local pyrandom = {} functio...&quot;</title>
		<link rel="alternate" type="text/html" href="https://glolfwiki.sibr.dev/index.php?title=Module:Pyrandom&amp;diff=208&amp;oldid=prev"/>
		<updated>2021-06-03T21:08:13Z</updated>

		<summary type="html">&lt;p&gt;Created page with &amp;quot;local mt = require &amp;quot;Module:Mt19937ar&amp;quot;  function bit_length(n) 	local l = 0 	while n &amp;gt; 0 do 		l = l + 1 		n = bit32.rshift(n, 1) 	end 	return l end  local pyrandom = {} functio...&amp;quot;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;local mt = require &amp;quot;Module:Mt19937ar&amp;quot;&lt;br /&gt;
&lt;br /&gt;
function bit_length(n)&lt;br /&gt;
	local l = 0&lt;br /&gt;
	while n &amp;gt; 0 do&lt;br /&gt;
		l = l + 1&lt;br /&gt;
		n = bit32.rshift(n, 1)&lt;br /&gt;
	end&lt;br /&gt;
	return l&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
local pyrandom = {}&lt;br /&gt;
function pyrandom.new(str)&lt;br /&gt;
	local instance = {}&lt;br /&gt;
&lt;br /&gt;
	function instance:seed(str)&lt;br /&gt;
		local seed = &amp;quot;&amp;quot;&lt;br /&gt;
		for i = 1, #str do&lt;br /&gt;
			seed = seed .. string.format('%02x', string.byte(str, i))&lt;br /&gt;
		end&lt;br /&gt;
		seed = seed .. mw.hash.hashValue(&amp;quot;sha512&amp;quot;, str)&lt;br /&gt;
		seed = string.rep('0', (8 - (#seed % 8)) % 8) .. seed&lt;br /&gt;
		seed_array = {}&lt;br /&gt;
		for i = #seed, 1, -8 do&lt;br /&gt;
			table.insert(seed_array, tonumber(string.sub(seed, i-7, i), 16))&lt;br /&gt;
		end&lt;br /&gt;
		local mt = mt.new()&lt;br /&gt;
		mt:init_by_array(seed_array)&lt;br /&gt;
		return mt&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	local rand = instance:seed(str)&lt;br /&gt;
&lt;br /&gt;
	function instance:random()&lt;br /&gt;
		return rand:genrand_res53()&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	function instance:getrandbits(k)&lt;br /&gt;
		if k == 0 then&lt;br /&gt;
			return 0&lt;br /&gt;
		end&lt;br /&gt;
&lt;br /&gt;
		return bit32.rshift(rand:genrand_int32(), (32 - k))&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	function instance:_randbelow(n)&lt;br /&gt;
		if n == 0 then&lt;br /&gt;
			return 0&lt;br /&gt;
		end&lt;br /&gt;
		local k = bit_length(n)&lt;br /&gt;
		local r = self:getrandbits(k)&lt;br /&gt;
		while r &amp;gt;= n do&lt;br /&gt;
			r = self:getrandbits(k)&lt;br /&gt;
		end&lt;br /&gt;
		return r&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	function instance:randrange(start, stop)&lt;br /&gt;
		if (stop == nil) then&lt;br /&gt;
			return self:_randbelow(start)&lt;br /&gt;
		end&lt;br /&gt;
&lt;br /&gt;
		return start + self:_randbelow(stop)&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	function instance:choice(array)&lt;br /&gt;
		local r = self:_randbelow(#array - 1)&lt;br /&gt;
		return array[r + 1]&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	local gauss_next = nil&lt;br /&gt;
	function instance:gauss(mu, sigma)&lt;br /&gt;
		local z = gauss_next&lt;br /&gt;
		gauss_next = nil&lt;br /&gt;
		if z == nil then&lt;br /&gt;
			local x2pi = self:random() * math.pi * 2&lt;br /&gt;
			local g2rad = math.sqrt(-2.0 * math.log(1.0 - self:random()))&lt;br /&gt;
			z = math.cos(x2pi) * g2rad&lt;br /&gt;
			gauss_next = math.sin(x2pi) * g2rad&lt;br /&gt;
		end&lt;br /&gt;
		return mu + z * sigma&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	return instance&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
return pyrandom&lt;/div&gt;</summary>
		<author><name>Pokeylope</name></author>
	</entry>
</feed>