Using Your Memory (Any Blitz, Any Level)

Blitz3D Forums/Blitz3D Tutorials/Using Your Memory (Any Blitz, Any Level)

Your first example, 'shuffling' an array, doesn't need a second array to track usage.
It can be done simply like this:
N = 9

Dim array(N)

For i=1 To N
	array(i)=i
Next

For i=1 To N-1        ; put random array element into position i
	k = Rand(i,N)
	temp = array(i) : array(i) = array(k) : array(k) = temp
Next

For i = 1 To N
	Print array(i)
Next

WaitKey : End