打开/关闭搜索
搜索
打开/关闭菜单
3
497
2
1.4K
此界与彼端
导航
首页
最近更改
随机页面
MediaWiki帮助
特殊页面
上传文件
切换首选项菜单
通知
打开/关闭个人菜单
未登录
未登录用户的IP地址会在进行任意编辑后公开展示。
user-interface-preferences
个人工具
登录
查看“︁模块:RandomUtil”︁的源代码
来自此界与彼端
分享此页面
查看
阅读
查看源代码
查看历史
associated-pages
模块
讨论
更多操作
←
模块:RandomUtil
因为以下原因,您没有权限编辑该页面:
您请求的操作仅限属于该用户组的用户执行:
用户
您可以查看和复制此页面的源代码。
-- Source: https://dontstarve.huijiwiki.com/wiki/%E6%A8%A1%E5%9D%97:Random -- Author: gjfLeo local getArgs = require("Module:Arguments").getArgs local p = {} function p.random(frame) math.randomseed(tostring(os.clock()*1000000):reverse():sub(1, 7)) local a = frame.args[1] or getArgs(frame)[1] local b = frame.args[2] or getArgs(frame)[2] local min = b and tonumber(a) or 0 local max = (b and tonumber(b) or 999) or (a and tonumber(a)) or 999 return math.random(min, max) end function p.choose(frame) local args = {} local i = 1 while (frame.args[i] or getArgs(frame)[i]) do table.insert(args, frame.args[i] or getArgs(frame)[i]) i = i + 1 end if #args == 0 then return end math.randomseed(tostring(os.clock()*1000000):reverse():sub(1, 7)) return args[math.random(#args)] end return p
该页面使用的模板:
模块:RandomUtil/doc
(
查看源代码
)
返回
模块:RandomUtil
。