Module:DidYouKnow: Difference between revisions

no edit summary
(Created page with "local p = {} -- CONFIG local DATA_PAGE = "Template:Did you know/Data" function p.main(frame) local title = mw.title.new(DATA_PAGE) if not title or not title.exists then return "<span class='error'>DidYouKnow: data page not found</span>" end local content = title:getContent() if not content then return "<span class='error'>DidYouKnow: no content</span>" end local items = {} -- Parse bullet list for line in content:g...")
 
No edit summary
Line 29: Line 29:
     end
     end


     -- Random selection
     -- Safe random seed
     math.randomseed(os.time() + tonumber(tostring({}):match("0x(.*)"), 16))
     math.randomseed(os.time())
    math.random() -- throw away first value
 
     local choice = items[math.random(#items)]
     local choice = items[math.random(#items)]
     return choice
     return choice
end
end


return p
return p