ScriptForge (SF_Array) fix tdf#158976 Shuffle()

The algorithm used to shuffle a 1D array
prevented any item of the array to remain
in the same entry after the shuffle.

This has been fixed. The potential targeted entries
to receive an item include the actual entry.

This change might impact existing scripts that
have Randomize()d their sorts to always get the
same shuffle results. This should impact test
scripts only.

SF_Array.Shuffle() is available in Basic only.
No impact on help pages.

Change-Id: If56d901f4af68f8889a7352c306bae6e3443ae97
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/161987
Reviewed-by: Jean-Pierre Ledure <jp@ledure.be>
Tested-by: Jenkins
(cherry picked from commit ca9168b8ad842c86b2168e12bb98087b9f8139bd)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/162009
Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
(cherry picked from commit d4898d7bbe8496504e36f7d91f55f62043f6a302)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/162105
diff --git a/wizards/source/scriptforge/SF_Array.xba b/wizards/source/scriptforge/SF_Array.xba
index 49bdab1..c124461 100644
--- a/wizards/source/scriptforge/SF_Array.xba
+++ b/wizards/source/scriptforge/SF_Array.xba
@@ -1767,7 +1767,7 @@ Try:
	Next i
	&apos;	Now ... shuffle !
	Do While lCurrentIndex &gt; lMin
		lRandomIndex = Int(Rnd * (lCurrentIndex - lMin)) + lMin
		lRandomIndex = Int(Rnd * (lCurrentIndex - lMin + 1)) + lMin
		vSwapValue = vShuffle(lCurrentIndex)
		vShuffle(lCurrentIndex) = vShuffle(lRandomIndex)
		vShuffle(lRandomIndex) = vSwapValue