Last Updated: February 25, 2016
· dionysios

Generate random symbols in Q

A quick way to generate random symbols in Q, with or without replacement is using the following idiom:


where x corresponds to the number of symbols in the output list and y is the number of letters for each symbol.

Interestingly, only the letters a though p are used, which gives a possible number of 16^y possible combinations.


-10?`1    / Ten random letters from a to p without replacement
10 ? `1    /Ten random letters from a to p with replacement   
L: asc -256 ? `1    / `#s `aa`ab…`pp
-17?`1   / `length