一个利用系统时间产生随机数的程序,比系统的随机函数真实
function Myrandom(Num: Integer): integer; var T: _SystemTime; X: integer; I: integer; begin Result := 0; GetSystemTime(T,',','); X := T.wDayOfWeek * T.wYear * T.wMilliseconds*T.wSecond * (random(Num)+1) + Random(1,',','); if X < 0 then X := -X; X := Random(X,',','); if(num = 0) then Exit; X := X mod num; for I := 0 to X do //通过随机发生次数来控制产生不同的随机数 X := Random(Num,',','); Result := X; end;
关键字词: