RosettaCodeData/Task/Knuth-shuffle/Liberty-BASIC/knuth-shuffle.basic
2023-07-01 13:44:08 -04:00

22 lines
536 B
Text

'Declared the UpperBound to prevent confusion with lots of 9's floating around....
UpperBound = 9
Dim array(UpperBound)
For i = 0 To UpperBound
array(i) = Int(Rnd(1) * 10)
Print array(i)
Next i
For i = 0 To UpperBound
'set a random value because we will need to use the same value twice
randval = Int(Rnd(1) * (UpperBound - i))
temp1 = array(randval)
temp2 = array((UpperBound - i))
array(randval) = temp2
array((UpperBound - i)) = temp1
Next i
Print
For i = 0 To UpperBound
Print array(i)
Next i