String Shuffle delete lock Revision 376262666637 (Mon Mar 12 2012 at 02:59) - Diff Link to this snippet: https://friendpaste.com/4vZfvOpbipg85Oke2QgG8Q Embed: manni perldoc borland colorful default murphy trac fruity autumn bw emacs pastie friendly Show line numbers Wrap lines 1234567891011121314151617181920212223242526272829303132333435Sub StringShuffle() ThisComponent.CurrentSelection.FormulaArray = ArrayShuffle(ThisComponent.CurrentSelection.FormulaArray)End SubFunction ArrayShuffle(ByVal src()) Dim res res = ArrayCopy(src) Dim i For i = UBound(res) To 1 Step -1 Dim j j = NumberRandom(0, i + 1) Dim t t = res(j) res(j) = res(i) res(i) = t Next ArrayShuffle = resEnd FunctionFunction ArrayCopy(ByVal src()) Dim res(UBound(src)) Dim i For i = 0 To UBound(res) res(i) = src(i) Next ArrayCopy = resEnd FunctionFunction NumberRandom(ByVal min, ByVal max) Dim len len = max - min Dim res res = Int(Rnd() * len) + min NumberRandom = resEnd Function