Randomize

Is there any way for Pascal to Randomly generate not numbers, but letters? I know this can be done with an Array, but is there a more elegant solution?

Comments

  • : Is there any way for Pascal to Randomly generate not numbers, but letters? I know this can be done with an Array, but is there a more elegant solution?
    :
    Here is a function to create a random char between 2 values:
    [code]
    function RandomChar(Lowest, Highest: char): char;
    begin
    RandomChar := char(
    Round(Random*(byte(Highest)-byte(Lowest)+1))+byte(Lowest));
    end;
    [/code]
    It is untested but should work.
Sign In or Register to comment.

Howdy, Stranger!

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

Categories

In this Discussion