KNOWLEDGE BASE
Log In    |    Knowledge Base    |    4D Home
Tech Tip: Utility method to return a random letter (A-Z)
PRODUCT: 4D | VERSION: 14.3 | PLATFORM: Mac & Win
Published On: March 16, 2015

Here is a Utility Method to generate a random letter between A - Z:

// returns a random letter A-Z (uppercase)

C_TEXT($0)
C_LONGINT($letter_num;$vEnd;$vStart)
$vEnd:=90
$vStart:=65
$letter_num:=(Random%($vEnd-$vStart+1))+$vStart
$0:=Char($letter_num)


If this method is saved in your database as UTIL_randomLetter_t it could be used like:
C_TEXT($letter)
$letter:=UTIL_randomLetter_t