<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://wiki.runerealm.org/index.php?action=history&amp;feed=atom&amp;title=Module%3ACalc%2FUser%3AGalvagornus</id>
	<title>Module:Calc/User:Galvagornus - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://wiki.runerealm.org/index.php?action=history&amp;feed=atom&amp;title=Module%3ACalc%2FUser%3AGalvagornus"/>
	<link rel="alternate" type="text/html" href="https://wiki.runerealm.org/index.php?title=Module:Calc/User:Galvagornus&amp;action=history"/>
	<updated>2026-05-05T15:20:54Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.41.1</generator>
	<entry>
		<id>https://wiki.runerealm.org/index.php?title=Module:Calc/User:Galvagornus&amp;diff=34430&amp;oldid=prev</id>
		<title>Alex: Created page with &quot;local p = {}  function expr(x) 	x = tostring(x) 	local expr_good, expr_val = pcall(mw.ext.ParserFunctions.expr, x) 	if expr_good then 		return tonumber(expr_val) 	end 	return nil end  -- from WP function choose(n,k) 	if k &lt; 0 or k &gt; n then 		return 0 	end 	if k == 0 or k == n then 		return 1 	end 	k = math.min(k, n-k) -- symmetry 	c = 1 	for i=0,k-1 do 		c = c * (n-i) / (k - i) 	end 	return c end  function flavourText(x) 	local flavourTexts = { 		{ -1, 1, &quot;You are some s...&quot;</title>
		<link rel="alternate" type="text/html" href="https://wiki.runerealm.org/index.php?title=Module:Calc/User:Galvagornus&amp;diff=34430&amp;oldid=prev"/>
		<updated>2024-10-16T23:00:39Z</updated>

		<summary type="html">&lt;p&gt;Created page with &amp;quot;local p = {}  function expr(x) 	x = tostring(x) 	local expr_good, expr_val = pcall(mw.ext.ParserFunctions.expr, x) 	if expr_good then 		return tonumber(expr_val) 	end 	return nil end  -- from WP function choose(n,k) 	if k &amp;lt; 0 or k &amp;gt; n then 		return 0 	end 	if k == 0 or k == n then 		return 1 	end 	k = math.min(k, n-k) -- symmetry 	c = 1 	for i=0,k-1 do 		c = c * (n-i) / (k - i) 	end 	return c end  function flavourText(x) 	local flavourTexts = { 		{ -1, 1, &amp;quot;You are some s...&amp;quot;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;local p = {}&lt;br /&gt;
&lt;br /&gt;
function expr(x)&lt;br /&gt;
	x = tostring(x)&lt;br /&gt;
	local expr_good, expr_val = pcall(mw.ext.ParserFunctions.expr, x)&lt;br /&gt;
	if expr_good then&lt;br /&gt;
		return tonumber(expr_val)&lt;br /&gt;
	end&lt;br /&gt;
	return nil&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
-- from WP&lt;br /&gt;
function choose(n,k)&lt;br /&gt;
	if k &amp;lt; 0 or k &amp;gt; n then&lt;br /&gt;
		return 0&lt;br /&gt;
	end&lt;br /&gt;
	if k == 0 or k == n then&lt;br /&gt;
		return 1&lt;br /&gt;
	end&lt;br /&gt;
	k = math.min(k, n-k) -- symmetry&lt;br /&gt;
	c = 1&lt;br /&gt;
	for i=0,k-1 do&lt;br /&gt;
		c = c * (n-i) / (k - i)&lt;br /&gt;
	end&lt;br /&gt;
	return c&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
function flavourText(x)&lt;br /&gt;
	local flavourTexts = {&lt;br /&gt;
		{ -1, 1, &amp;quot;You are some sort of sentient water being you&amp;#039;re so not-dry. How&amp;#039;d you even do this?&amp;quot; },&lt;br /&gt;
		{ 1, 10, &amp;quot;You&amp;#039;re a higher % water than a watermelon.&amp;quot; },&lt;br /&gt;
		{ 10, 20, &amp;quot;Only ironmen can be this lucky.&amp;quot; },&lt;br /&gt;
		{ 20, 30, &amp;quot;Spooned.&amp;quot; },&lt;br /&gt;
		{ 30, 40, &amp;quot;Your friends will be jealous.&amp;quot; },&lt;br /&gt;
		{ 40, 49, &amp;quot;You&amp;#039;re quite the lucker aren&amp;#039;t you.&amp;quot; },&lt;br /&gt;
		{ 49, 51, &amp;quot;A perfect mix of dry and undry, as all things should be.&amp;quot; },&lt;br /&gt;
		{ 51, 61, &amp;#039;Nothing interesting happens.&amp;#039; },&lt;br /&gt;
		{ 61, 65, &amp;quot;An unenlightened being would say &amp;#039;but 1/x over x kills means I should get it&amp;#039;, but you know better now.&amp;quot; },&lt;br /&gt;
		{ 65, 73, &amp;#039;Nothing interesting happens.&amp;#039; },&lt;br /&gt;
		{ 73, 74, &amp;quot;😂😂😂&amp;quot; },&lt;br /&gt;
		{ 74, 85, &amp;quot;oof&amp;quot; },&lt;br /&gt;
		{ 85, 90, &amp;quot;A national emergency has been declared in your drop log.&amp;quot; },&lt;br /&gt;
		{ 90, 95, &amp;quot;Right, time to post on reddit.&amp;quot; },&lt;br /&gt;
		{ 95, 99, &amp;quot;You after being this dry: [[File:Skeleton.png|80x80px]]&amp;quot; },&lt;br /&gt;
		{ 99, 99.5, &amp;quot;You are so dry you have collapsed into the dry singularity. The dryularity, if you will.&amp;quot; },&lt;br /&gt;
		{ 99.5, 99.9, &amp;quot;The vacuum of space has more activity than your drop log.&amp;quot; },&lt;br /&gt;
		{ 99.9, 99.99, &amp;quot;Wow that&amp;#039;s so rare! Seems like it&amp;#039;s bugged. We tweeted @JagexAsh for you, we&amp;#039;re sure he&amp;#039;ll get to the bottom of it in the next 24 hours.&amp;quot; },&lt;br /&gt;
		{ 99.99, 1000, &amp;quot;Did you forget to talk to [[Oziach]]?&amp;quot; }&lt;br /&gt;
	}&lt;br /&gt;
	for i,v in ipairs(flavourTexts) do&lt;br /&gt;
		if x &amp;gt;= v[1] and x &amp;lt;= v[2] then&lt;br /&gt;
			return v[3]&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
	return &amp;#039;&amp;#039;&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
function p.main(frame)&lt;br /&gt;
	local args = frame.args&lt;br /&gt;
	return p.calc(args.chance, args.kills, args.dropped)&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
function p.calc(chanceTxt, kc, obtained)&lt;br /&gt;
	local chance = expr(chanceTxt)&lt;br /&gt;
	if not chance then&lt;br /&gt;
		return &amp;#039;Looks like there was an error with your input chance, try typing it in again&amp;#039;&lt;br /&gt;
	else&lt;br /&gt;
		if chance &amp;gt; 1 then&lt;br /&gt;
			return &amp;quot;You put your chance at over 1 you absolute madman&amp;quot;&lt;br /&gt;
		elseif chance &amp;lt;= 0 then&lt;br /&gt;
			return &amp;quot;You put your chance at 0 or negative, how you gonna get that drop?&amp;quot;&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
	local notchance = 1 - chance&lt;br /&gt;
		&lt;br /&gt;
	&lt;br /&gt;
	kc = tonumber(kc)&lt;br /&gt;
	if not kc or kc == 0 then&lt;br /&gt;
		return &amp;quot;You ain&amp;#039;t killed anything you crazy fool&amp;quot;&lt;br /&gt;
	end&lt;br /&gt;
	obtained = tonumber(obtained) or 0&lt;br /&gt;
	&lt;br /&gt;
	if kc &amp;lt; obtained then&lt;br /&gt;
		return &amp;quot;?????&amp;quot;&lt;br /&gt;
	end&lt;br /&gt;
	&lt;br /&gt;
	if choose(kc, obtained) == 1/0 then -- Check if we can handle these values&lt;br /&gt;
		return &amp;quot;Sorry, your killcount and obtained number combination is too large for this calculator. Try reducing your numbers.&amp;quot;&lt;br /&gt;
	end&lt;br /&gt;
	&lt;br /&gt;
	local luck = 0.0&lt;br /&gt;
	for i=0, obtained do&lt;br /&gt;
		luck = luck + choose(kc, i) * math.pow(chance, i) * math.pow(1-chance, kc-i)&lt;br /&gt;
	end&lt;br /&gt;
	return string.format(&amp;quot;You killed %s monsters for an item with a %s (%.6f%%) drop chance. You had a:\n* %.4f%% chance of getting %s drops or fewer\n* %.4f%% chance of getting more than %s drops. %s&amp;quot;, kc, chanceTxt, 100*chance, 100*luck, obtained, 100*(1.0-luck),obtained, flavourText((1.0-luck)*100))&lt;br /&gt;
&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
return p&lt;/div&gt;</summary>
		<author><name>Alex</name></author>
	</entry>
</feed>