今天是2025年12月19日 第51周 星期五
代人,时大变了。
我们生活在大地上,但我们的梦想超越天空。
“模块:沙盒/Shinonome Akebono/S”的版本间的差异
< 模块:沙盒
跳到导航
跳到搜索
小 |
小 (Shinonome Akebono移动页面模块:沙盒/Sm至模块:沙盒/Shinonome Akebono/S,不留重定向) |
||
| (未显示同一用户的6个中间版本) | |||
| 第1行: | 第1行: | ||
local p = {} | local p = {} | ||
| + | |||
| + | local getArgs = require('Module:Arguments').getArgs | ||
function p.hello() | function p.hello() | ||
| − | return "Hello | + | return "Hello world!" |
| + | end | ||
| + | |||
| + | function p.lang(frame) | ||
| + | local args=getArgs(frame) | ||
| + | local text=args[1] | ||
| + | local lang=args[2] | ||
| + | local span=mw.html.create('span') | ||
| + | :attr('lang',lang) | ||
| + | :wikitext(text) | ||
| + | return span | ||
| + | end | ||
| + | |||
| + | local function qp(a,b,c) | ||
| + | local ans=1 | ||
| + | local base=a | ||
| + | local exp=b | ||
| + | while exp>0 do | ||
| + | if exp%2==1 then | ||
| + | ans=ans*base%c | ||
| + | end | ||
| + | base=base*base%c | ||
| + | exp=(exp-(exp%2))/2 | ||
| + | end | ||
| + | return ans | ||
end | end | ||
| + | function p.rand(frame) | ||
| + | local prime=0x125E591 | ||
| + | local args=getArgs(frame) | ||
| + | local bound=args[1] | ||
| + | local time=math.modf(os.time()*math.random())%prime | ||
| + | local pert=3254518517%prime | ||
| + | pert=qp(qp(pert,time,prime),qp(time,pert,prime),prime) | ||
| + | return pert%bound | ||
| + | end | ||
return p | return p | ||
2020年7月8日 (三) 21:01的最新版本
local p = {}
local getArgs = require('Module:Arguments').getArgs
function p.hello()
return "Hello world!"
end
function p.lang(frame)
local args=getArgs(frame)
local text=args[1]
local lang=args[2]
local span=mw.html.create('span')
:attr('lang',lang)
:wikitext(text)
return span
end
local function qp(a,b,c)
local ans=1
local base=a
local exp=b
while exp>0 do
if exp%2==1 then
ans=ans*base%c
end
base=base*base%c
exp=(exp-(exp%2))/2
end
return ans
end
function p.rand(frame)
local prime=0x125E591
local args=getArgs(frame)
local bound=args[1]
local time=math.modf(os.time()*math.random())%prime
local pert=3254518517%prime
pert=qp(qp(pert,time,prime),qp(time,pert,prime),prime)
return pert%bound
end
return p