Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

random character help

Can anyone tell me how to program a button that will generate a random vowel?

Thanx

Comments

  • zibadianzibadian Member Posts: 6,349
    : Can anyone tell me how to program a button that will generate a random vowel?
    :
    : Thanx
    :
    Here is a small code, which shows two approaches. The commented code will get any ascii char, while the actual code will only get the ones listed in the string.
    [code]
    procedure TForm1.Button1Click(Sender: TObject);
    const
    Chars: string = 'abcdefghijklmnopqrstuvwxyz';
    var
    i: integer;
    begin
    // Button1.Caption := char(Random(255));
    Button1.Caption := Chars[Random(Length(Chars))+1];
    end;
    [/code]
Sign In or Register to comment.