پودمان:Judicial verdict: تفاوت میان نسخه‌ها

پرش به ناوبری پرش به جستجو
بدون خلاصۀ ویرایش
بدون خلاصۀ ویرایش
خط ۲۹: خط ۲۹:
function p.main(frame)
function p.main(frame)
     local result = ""
     local result = ""
    local dataShuffled = FYShuffle(data)
     for i = 1, #data, 1 do
     for i = 1, 11, 1 do
         result = result .. data[i]
         result = result .. dataShuffled[i]
     end
     end
     return result
     return result
end
-- Source: https://stackoverflow.com/questions/35572435/how-do-you-do-the-fisher-yates-shuffle-in-lua
function FYShuffle(tInput)
    math.randomseed(os.time())
    local tReturn = {}
    for i = #tInput, 1, -1 do
        local j = math.random(i)
        tInput[i], tInput[j] = tInput[j], tInput[i]
        table.insert(tReturn, tInput[i])
    end
    return tReturn
end
end


return p
return p