不知delphi5中可使用的随即函数格式如何?如何写?
假如要从110000中,随即抽取一个数值出来,如何实现?
且可以一次取出多个值吗?
盼复!

解决方案 »

  1.   

    procedure Randomize;
    //Initializes the random number generator with a random value.
    Random function
    //Generates random numbers within a specified range.var
       I: Integer;
     begin
       Randomize;
       for I := 1 to 50 do begin
         { Write to window at random locations }
         Canvas.TextOut(Random(Width), Random(Height), 'Boo!');
       end;
     end;
      

  2.   

    procedure TForm1.Button1Click(Sender: TObject);
    begin
    Randomize;
    showmessage(inttostr(random(10000)+1));
    end;