Posted: 11th Jan 2022 2:22
while i've seen other Shuffle functions, here's a different (and dynamic) approach:
+ Code Snippet
// set display properties
SetVirtualResolution( 1280,720)
SetOrientationAllowed( 1, 1, 1, 1 )
SetSyncRate( 30, 0 ) 
SetScissor( 0,0,0,0 )
UseNewDefaultFonts( 1 ) 

GLOBAL MyArray as Integer []
for x = 0 to 5
	MyArray.Insert(x)
next x

do
	for x = 0 to MyArray.Length
		Print(STR(MyArray[x]))
	next x
	if LastShuffle# + 1.0 <= Timer()
		Shuffle()	:	LastShuffle# = Timer()
	Endif
    Sync()
loop

Function Shuffle()
	TempArray as Integer []
	for x = 0 to MyArray.Length
		TempArray.Insert(MyArray[x])
	next x
	for x = MyArray.Length to 0 step -1
		MyArray.Remove()
	next x
	all = TempArray.Length
	for x = 0 to all
		ThisIndex = Random(0,TempArray.Length)
		MyArray.Insert(TempArray[ThisIndex])
		TempArray.Remove(ThisIndex)
	next x
EndFunction

basically, clone the array then feed the values back in randomly.
Posted: 11th Jan 2022 3:15
Deck of Cards:
+ Code Snippet
// set display properties
SetWindowSize( 1280,720, 0 )
SetVirtualResolution( 1280,720)
SetOrientationAllowed( 1, 1, 1, 1 )
SetSyncRate( 30, 0 ) 
SetScissor( 0,0,0,0 )
UseNewDefaultFonts( 1 )
SetPrintColor(0,0,0)
SetClearColor(255,255,255)

Suits$ = "♣♦♥♠"

Type Card
	Value, Suit$, Face$
EndType

GLOBAL Deck as Card []
for x = 1 to 4
	ThisSuit$ = MID(Suits$,x,1)
	for y = 1 to 13
		ThisCard as Card
		ThisCard.Value = y
			Face$ = STR(y)+ThisSuit$
			If y = 1 then Face$  = "A" + ThisSuit$
			If y = 11 then Face$ = "J" + ThisSuit$
			If y = 12 then Face$ = "Q" + ThisSuit$
			If y = 13 then Face$ = "K" + ThisSuit$
		ThisCard.Face$ = Face$
		ThisCard.Suit$ = ThisSuit$
	Deck.Insert(ThisCard)
	next y
next x

GLOBAL TheseCards as Integer []
for x = 1 to 13
	for y = 1 to 4
		ThisTXT = CreateText("")	:	SetTextAlignment(ThisTXT,1)
		SetTextPosition(ThisTXT, x*70,y*48)
		SetTextSize(ThisTXT,48)		:	TheseCards.Insert(ThisTXT)
	next y
Next x
Shuffle()
do
	if GetRawKeyPressed(27) then End
	
	if GetPointerPressed() then Shuffle()
	
	Print("Tap to Shuffle")
    Sync()
loop

Function Shuffle()
	TempArray as Card []
	for x = 0 to Deck.Length
		TempArray.insert(Deck[x])
	next x
	
	for x = Deck.Length to 0 step -1
		Deck.Remove()
	next x
	
	all = TempArray.Length
	for x = 0 to all
		ThisIndex = Random(0,TempArray.Length)
		Deck.Insert(TempArray[ThisIndex])
		TempArray.Remove(ThisIndex)
	next x
	
	For x = 0 to TheseCards.Length
		If Deck[x].Suit$ = "♣" or Deck[x].Suit$ = "♠"
			SetTextColor(TheseCards[x],0,0,0,255)
		Else
			SetTextColor(TheseCards[x],255,0,0,255)
		Endif
		SetTextString(TheseCards[x],Deck[x].Face$)
	Next x
EndFunction