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

پرش به ناوبری پرش به جستجو
بدون خلاصۀ ویرایش
بدون خلاصۀ ویرایش
بدون خلاصۀ ویرایش
خط ۵۳: خط ۵۳:


-- Source: https://stackoverflow.com/questions/35572435/how-do-you-do-the-fisher-yates-shuffle-in-lua
-- Source: https://stackoverflow.com/questions/35572435/how-do-you-do-the-fisher-yates-shuffle-in-lua
function FYShuffle(tInput)
function FYShuffle(tInput, indexList)
    math.randomseed(os.time())
     local tReturn = {}
     local tReturn = {}
     for i = #tInput, 1, -1 do
     for i = #tInput, 1, -1 do
         local j = math.random(i)
         local j = indexList[#tInput - i + 1]
         tInput[i], tInput[j] = tInput[j], tInput[i]
         tInput[i], tInput[j] = tInput[j], tInput[i]
         table.insert(tReturn, tInput[i])
         table.insert(tReturn, tInput[i])
خط ۶۳: خط ۶۲:
     return tReturn
     return tReturn
end
end


return p
return p

منوی ناوبری