Util.RandomChar

Top  Previous  Next

 

Syntax

function Util.RandomChar(MinOrdValue: integer; MaxOrdValue: integer): string

 

Alternative Names

ibec_RandomChar

 

Description

Returns a random character between the given character ordinal value bounds of MinOrdValue and MaxOrdValue.

 

The Return Value is a single character.

 

See Also

Util.Chr
Util.Ord
Util.RandomString

 

Example

execute UDSBlock

as

begin

  /* get a series of random characters between 'a' and 'z' and put them into a single string */

  i = 0;

  str = '';

  while (i < 30) do

  begin

    c = Util.RandomChar(Util.Ord('a'), Util.Ord('z'));

 str = str || c;

    i = i + 1;

  end 

  GUI.ShowMessage('Random string: ' || str);

 

  /* generate a series of random characters between 'a' and 'z' with a minimum length of 10 < 30 */

  str = Util.RandomString(10, 30, Util.Ord('a'), Util.Ord('z'));

  GUI.ShowMessage('Random string: ' || str);

end