Software /
code /
prosody
Comparison
util/array.lua @ 7700:0d70410efdcf
util.array: Remove unused arguments [luacheck]
author | Kim Alvefur <zash@zash.se> |
---|---|
date | Tue, 18 Oct 2016 15:16:30 +0200 |
parent | 7699:9c40d0be2295 |
child | 7976:2a7ef5fcaa77 |
comparison
equal
deleted
inserted
replaced
7699:9c40d0be2295 | 7700:0d70410efdcf |
---|---|
104 end | 104 end |
105 return outa; | 105 return outa; |
106 end | 106 end |
107 | 107 |
108 --- These methods only mutate the array | 108 --- These methods only mutate the array |
109 function array_methods:shuffle(outa, ina) | 109 function array_methods:shuffle() |
110 local len = #self; | 110 local len = #self; |
111 for i = 1, #self do | 111 for i = 1, #self do |
112 local r = math_random(i, len); | 112 local r = math_random(i, len); |
113 self[i], self[r] = self[r], self[i]; | 113 self[i], self[r] = self[r], self[i]; |
114 end | 114 end |