Solved
Random number
Posted on 2001-07-03
i got a problem in a code i made here it is:
function altdom (Zero:integer) : integer;
var
TD:TDateTime;
ms:word;
i,res:integer;
a,b:array[1..3] of word;
begin
TD:=Now;
DecodeTime(TD,a[1],a[2],a[3],ms);
DecodeDate(TD,b[1],b[2],b[3]);
res:=3;
for i:=1 to ms do // replace the 10 in what number u want...
begin
res:=a[1]*a[2]*a[3]+res;
res:=res*(b[1]+b[2]-b[3])-ms;
res:=res*a[1]-ms;
res:=res div b[3];
end;
if res=0 then res:=ms*b[2];
res:=(res mod 5) + res ;
result:=abs(res mod zero); <---- this is probably the ugly mistake but i dont know what i should do about it :(
end;
procedure TForm1.Button1Click(Sender: TObject);
begin
sleep(altdom(0)*3);
label1.caption := inttostr(altdom(StrToInt(Label5.caption)));
end;
i want the program to choose a random number from label5.caption, and i dont wana use Random(number)
ex if label5.caption := 1000 then it chooses a number from 1000 ex 526