require('strict');localcontent=mw.title.getCurrentTitle():getContent()or'';-- get the content of the list page--[[--------------------------< R A N D O M _ S O R T >--------------------------------------------------------swaps two members of a sequence table. One member is indexed sequentially (starting at [1]), the other indexis randomly selected.]]localfunctionrandom_sort(frame)localsource=setmetatable({},{__index=table})localr_idx;forarticleincontent:gmatch('([^\r\n]+)[\r\n]+')do-- get an article titleifnot(article:match('<!%-%-')or-- skip any line that has opening commentarticle:match('%-%->')or-- skip any line that has closing commentarticle:match('{{')or-- skip the line that holds the {{#invoke:}} for this function''==article)then-- skip these -- skip empty linessource:insert(article);-- all others, add to the listendendmath.randomseed(os.time());-- init random number generator with current timestampfori,vinipairs(source)dor_idx=math.random(i,#source)-- random index between i and length of source{} ([[Fisher–Yates shuffle]] per Anomie at my talk page)ifi~=r_idxthen-- if i and r_idx happen to be the same, don't bother swapping this article title with itselfsourcei],sourcer_idx=sourcer_idx],sourcei];-- swap article titles source[i] and source[r_idx]endendreturntable.concat({'count = ',#source,'<br />',frame:callParserFunction('#tag:syntaxhighlight',source:concat('\n'))});end--[[--------------------------< E X P O R T E D F U N C T I O N----------------------------------------------]]return{random_sort=random_sort}