SRL Archive - Help and Support

Need Help.


syberium

2008-03-03 17:54:18

Ok, so I need this script to randomize these Const's then print them 70 times. Problem is i only know how to randomly make it choose one const. I need it to arrange them in a random order then print them in that order. Im thinking some form of array, Im working on it as i type this but i also need help on how to accomplish this. heres the sample of it so you guys can get the 'jist' of it.

 

program New;

Const
a = 'aa';
b = 'bb ';
c = 'cc ';
d = 'dd ';
e = 'Dd ';
f = 'Ee ';
g = 'ff ';
h = 'gg ';
i = 'hh ';
j = 'Ii ';

Procedure Sent;

begin
writeln(a + b + c + d + e + f + g + h + i);

end;




begin
Sent;
end.



Sir R. M8gic1an

2008-03-04 15:28:10

i don't know a way to do it with consts, but if you have no special reason to use them you can do it this way.
and it's just as easy to set up.


program New;
var
TSA:TStringArray;
FinalS:string;


procedure GetTSA;
begin
SetLength(TSA, 4);
TSA[0] := 'aa';
TSA[1] := 'bb';
TSA[2] := 'cc';
TSA[3] := 'dd';
end;

procedure RandomizeTSA;
var
TBA : array of boolean;
x, i: integer;
begin
SetLength(TBA, Length(TSA));
i:=0;
repeat
x:=Random(length(TSA));
if not TBA[x] then
begin
TBA[x] := True;
FinalS := FinalS+TSA[x];
Inc(i);
end;

until(i >= Length(TSA));
end;

begin
GetTSA;
RandomizeTSA;
writeln(FinalS);
end.

~RM

Cazax

2008-03-04 16:18:20

Hey you already start a thread asking that with the same name.

syberium

2008-03-04 22:36:05

thanks alot man :)