delphi中怎样生成一个8位的随机数?

解决方案 »

  1.   

    Randomize;
       Edit1.Text:=Inttostr(Random(99999999));
      

  2.   

    楼上的大哥
    In Delphi code, Random returns a random number within the range 0 <= X < Range.
    不一定是八位啊。
      

  3.   

    Edit1.Text:=Inttostr(Random(9))+Inttostr(Random(9))+Inttostr(Random(9))+Inttostr(Random(9))+Inttostr(Random(9))+Inttostr(Random(9))+Inttostr(Random(9))+Inttostr(Random(9);
      

  4.   

    Randomize;
      Edit1.Text:=FormatFloat('00000000',Random(99999999));
      

  5.   

    Randomize;
      
    Edit1.Text:=Format('%.8d',[Random(99999999)]);Edit1.Text:=Format('%.4d%.4d',[Random(9999),Random(9999)]);
      

  6.   

    严重同意 cdsgajxlp(起名很难) !