Shuffle list and print
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)
4.2
5
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;
Thank you!
5
0
Are there any code examples left?
New code examples in category Delphi
-
Delphi 2022-03-27 19:40:03 delphi keydown enter
-
Delphi 2022-03-20 03:25:01 get time in milliseconds delphi
-
Delphi 2022-03-16 18:50:01 delphi random letter
-
Delphi 2022-02-14 03:45:08 remove unnecessary packages raspi pixel
-
Delphi 2022-02-02 21:15:46 delete in delphi
-
Delphi 2022-02-02 17:26:35 INSERT into syntax error in delphi
-
Delphi 2022-01-23 12:15:39 pyhton instagram bot
-
Delphi 2022-01-23 09:05:59 delphi calculator
-
Delphi 2021-11-21 18:31:10 download jupyter for linux
-
Delphi 2021-11-20 04:57:08 copy delphi