# LogicTest: local

query I
SELECT count(*) FROM crdb_internal.gen_rand_ident('hello', 10)
----
10

# The following tests override the parameter default to fix the random seed,
# to ensure that the results remain stable.

query T nosort
SELECT crdb_internal.gen_rand_ident('helloworld', 10, '{"seed":123}')
----
helloworld_1
heLlowor%pld    _2
hell😆oworld_3
helloworld_4
helloworld_5
helloworld_6
helloWorld_7
helloworld_8
h%velloworld_9
hellowo         rld_10

query T nosort
SELECT crdb_internal.gen_rand_ident('helloworld', 10, '{"seed":123,"suffix":false}')
----
helloworld
heLlowor%pld
hell😆oworld
helloworld
helloworld
helloworld
helloWorld
helloworld
h%velloworld
hellowo       rld

# All types of noise enabled except for one: set prob to -1.
query T nosort
SELECT crdb_internal.gen_rand_ident('helloworld', 10, '{"seed":123,"noise":true,"emote":-1}')
----
helloworld_1
hell\roworld%56_2
he"llowo rld_3
helloworld_4
helloworld_5
helloworld_6
helloworld_7
hel
loworld_8
helloworld_9
h elloworld_10

query T nosort
SELECT crdb_internal.gen_rand_ident('helloworld', 10, '{"seed":123,"noise":false}')
----
helloworld_1
helloworld_2
helloworld_3
helloworld_4
helloworld_5
helloworld_6
helloworld_7
helloworld_8
helloworld_9
helloworld_10

query T nosort
SELECT crdb_internal.gen_rand_ident('helloworld', 10, '{"seed":123,"noise":false,"punctuate":1}')
----
h*ello}world&_1
helloworld_2
helloworld_3
hell(oworld-_4
hellowo/rld_5
helloworld_6
hell.ow!orld_7
helloworld_8
he}lloworld_9
h%elloworld_10

query T nosort
SELECT crdb_internal.gen_rand_ident('helloworld', 10, '{"seed":123,"noise":false,"quote":1}')
----
h"ello"world"_1
helloworld_2
helloworld_3
hell'oworld"_4
hellowo'rld_5
helloworld_6
hell"ow'orld_7
helloworld_8
he'lloworld_9
h'elloworld_10

query T nosort
SELECT crdb_internal.gen_rand_ident('helloworld', 10, '{"seed":123,"noise":false,"space":1}')
----
h ellow orld_1
h elloworld_2
helloworld_3
hellowo rld_4
hel loworld_5
h e lloworld_6
helloworld _7
he lloworld_8
helloworld _9
helloworld _10

query T nosort
SELECT quote_ident(crdb_internal.gen_rand_ident('helloworld', 10, '{"seed":123,"noise":false,"whitespace":1}'))
----
"h  ello  world  _1"
helloworld_2
helloworld_3
"hell
oworld           _4"
"hellowo
rld_5"
helloworld_6
"hell
ow orld_7"
helloworld_8
"he
lloworld_9"
"h elloworld_10"

query T nosort
SELECT crdb_internal.gen_rand_ident('helloworld', 10, '{"seed":123,"noise":false,"emote":1}')
----
h😟ello😺world😋_1
helloworld_2
helloworld_3
hell😅oworld😵_4
hellowo😓rld_5
helloworld_6
hell😉ow😉orld_7
helloworld_8
he😙lloworld_9
h😞elloworld_10

query T nosort
SELECT crdb_internal.gen_rand_ident('aeaeiao', 10, '{"seed":123,"noise":false,"diacritics":3,"diacritic_depth":4}')
----
aẹͫae̩͇iao̅͘_1
ā̞e͠a̶̓eia̲o_2
a̲̾e̙̺ae̴ͥia͍͟o_3
aea͎ḙͭi͖͞aͪo_4
ae͌aei̷͓a̺o_5
a͔ͪeaeiaͧo̦_6
aeͨä̯́ei̒a̸o_7
aeaeͮi̪ͅa͚̓o_8
aeaeǐ̉aͭ͜o̩̚_9
aeaeĩ͊ã̓o_10

query T nosort
SELECT crdb_internal.gen_rand_ident('aeaeiao', 10, '{"seed":123,"noise":false,"zalgo":true}')
----
a̫̣̳̟̩͇̻͎ͫ̇e̶͍̞̝̅̄̊ͦ́͘͟͠ă̢͔̲͙̲͙̙̺̼̍̾̃͑͢è̴̸̛͍̠̥͎̰̭ͣͥͭ̚͟͠i͖͇̦͑ͪͪ͋͌͜͞ȁ̷͓̗̺̻̣̽ͪ͛ő̳̭ͯͬ̐ͧͤ͌_1
a̠̯̿ͨ̐ͧ̈́ͬ́̔̒ě̸̛ͮ̚͟͢a̷e̵͚̰̖ͭ̓̑̃̓̏̌̕i̴̱̩̹̇ͭͨͮ͐̍̃̚͘͜ã̡̡̼̓͂̉͟ͅͅo̡̖̹̓͞_2
a̵̦͋̈́͒ͦ̽̇͌e̡ͧ̊a̷̢̢̟̯͕͒̓͋̃̋͊ͨ͟e̸̡͎̥̺͙̓̂̚i̍ͦ͊͏̴̷ͩ̄̆̽̃ͥ͜͡ͅͅͅḁ̖̭͚̘̗̠͈̬̔̿̐o̧̪̬̗̳͑ͮͩ̂͘_3
á̢̌e͓͒̒ͥ͠͏̝̳̈́̀̕ã̸̱̻̥̻̩̒ͧͨͨ̔͆̀̊ͦ͊͝ẽi̶̢̛̠̜̣̘̋̽́͑̅̏̇̋̈́͡ȧ̻ǫ̬̩̳͈̍̌̈̈́͞͞_4
a̸̛̦̝̰̠̖̺ͫ̍͑͂̀̊̽͠e͏̰̘͚͙̙̣͕͔̝̋ͨ͋̀̓̏͘͜a̯̭̯͕̲ͣ̓̈́ͥ͌ͧͬ̚͝e̢̖̫̯͔̽ͯ̐͐̇̊̾͂ͬi̙͗͋̄̇͝͞͡͏̼̗̱̃́a̙̩̔͏͈̫̣̍́ỡ̱̞̒͆́ͯͦ͑͠_5
a̷̫̥̣̦̦̭͗͆̅͐ͬ̓ͥ̚ḙ̶̛̲̳̻̯̙̺̅ͪͦ̎͌͟ạ̷̢̤̤͗͊ͧͩ̑͋͡e̘͉̜̮͍̰͔̊ͨ̆̄̅i̙͚͇̳͕̺̰ͮ̃̋͂̂ͮͣậ̫̞̜̱̌ͭ̋ͬ̎͛͠ȯ̞̻̘̐̌_6
áe̷̷̙̟̜̮͕̋͘͝a͓͖ẹ͉͈̦͛ͩ̔͋ͫ̽̊i̻̫̋̍ͬ͆̒̌a̮̬̼̳͉ͦͩ͋ͣͥͧ̐͂ͩ̓ͭ̕o̯͛͢͏̝̬͎̬̘̥͈̯ͫ̅̆͛̚͡_7
ǎ͎͎͙̬͓̫̮͙ͮ̈ͣeͩ͜ȃ̢̧͓̣͕̭ͤe̦̝̤̲̭ͬ̒͊̊͆͜͏̚͞i͉͈͍͚̿̊ͬ̑̚ā̵̜̪͕͕̼̘͂̿́̀͠͝ớ͖͓̳̯̍ͮ͒͑̔ͩ̋̒͡_8
ȧ̢̙̝͕͕̘̦́̋ͫ̀̔͘̚͢͞͠è̵̫̰̾̔͌͂͘͜͝a̸̳̦͂̒ͥ͗e̴̢͕̋̑̄ͪ̊͋́̕i͖̹̟͘͞ą̙͋͊̀ͬọ̬̩͗̈́_9
ȃ̒̉̃͢͝ͅe͡a͖͖̩̦͆̇̽̅͌̃͡e̶̸͙͚̣̩̓͂̿̈̀ͬͤ̌̐̚i̬̲̩͊́̐̀̚a̧͍̞̜̓͒́̅o̯͕̗̹͔̘ͫ̅ͯ̒ͭ͒̐̀̔̿͢͞_10
