- Categories:
RANDSTR¶
Returns a random string of specifiedlength
.
Syntax¶
RANDSTR(<length>,<gen>)
Copy
Usage notes¶
Individual characters are chosen uniformly at random from the following pool of characters: 0-9, a-z, A-Z.
The value for the generator expression,
gen
, is used as the seed for this uniform random distribution. For more information about generator expressions, seeUsage notes.
Examples¶
SELECTrandstr(5,random())FROMtable(generator(rowCount=>5));+----------------------+| RANDSTR(5, RANDOM()) ||----------------------|| rM6ep || nsWJ0 || IQi5H || VBNvY || wjk6y |+----------------------+
Copy
SELECTrandstr(5,1234)FROMtable(generator(rowCount=>5));+------------------+| RANDSTR(5, 1234) ||------------------|| E5tav || E5tav || E5tav || E5tav || E5tav |+------------------+
Copy
SELECTrandstr(abs(random())%10,random())FROMtable(generator(rowCount=>5));+---------------------------------------+| RANDSTR(ABS(RANDOM()) % 10, RANDOM()) ||---------------------------------------|| e || iR || qRwWl7W6 || || Yg |+---------------------------------------+
Copy