Module:DidYouKnow

local p = {} local facts = require("Module:DidYouKnow/facts")

-- Apparently this counts days from November 3, 2018? What is that supposed to do? --ATCN function getCurrentDay local now = os.date("!*t") local day = now["day"] local month = now["month"] local year = now["year"] if month < 3 then year = year-1 month = month+12 end local A = math.floor(year/100) local B = math.floor(A/4) local C = 2-A+B local E = math.floor(365.25*(year+4716)) local F = math.floor(30.6001*(month+1)) return C+day+E+F-2459950 end

function p.getFacts local s = "" local length = #facts.facts math.randomseed(getCurrentDay) for i = 0, 4 do s = s .. "* ... that " .. facts.facts[math.random(1, length)] .. "?"		if i < 4 then s = s .. "\n" end end return s end

-- List all facts. Intended to allow easier debugging. function p.getAllFacts local result = {} local length = #facts.facts for i = 1, length do result[i] = "* ... that " .. facts.facts[i] .. "?"	end return table.concat(result, "\n") end

return p