Shuffle list and print code example
Example 1: python shuffle list
import random
number_list = [7, 14, 21, 28, 35, 42, 49, 56, 63, 70]
print ("Original list : ", number_list)
random.shuffle(number_list) #shuffle method
print ("List after shuffle : ", number_list)
Example 2: Shuffle list and print
Function SortIntegerList : String;
var a : Array of cardinal;
i,j : integer;
t : cardinal;
Letter : String[1];
AStr : String;
begin
// USING the simple Satolo cycle to unsort/scramble a numeric string
// Modified to scramble the letters of the Alphabet
randomize;
a := [1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26];
i := length(a);
while i > 0 do
begin
dec(i);
j := randomrange(Low(a),i);
t := a[i];
a[i] := a[j];
a[j] := t;
Letter := Chr(a[i]+64);
AStr := AStr + Letter;
end;
Result := AStr;
end;
// How to use
Procedure ButtonClick(Sender: TOBject);
begin
ShowMessage('Scrambled String '+AStr);
end;