Generates a (pseudo)random permutation of the code points in each string.
Details
This operation may result in non-Unicode-normalized strings and may give peculiar outputs in case of bidirectional strings.
See also stri_reverse for reversing the order of code points.
See also
The official online manual of stringi at https://stringi.gagolewski.com/
Gagolewski M., stringi: Fast and portable character string processing in R, Journal of Statistical Software 103(2), 2022, 1-59, doi:10.18637/jss.v103.i02
Other random:
stri_rand_lipsum(),
stri_rand_strings()
Author
Marek Gagolewski and other contributors
Examples
stri_rand_shuffle(c('abcdefghi', '0123456789'))
#> [1] "acfhdibge" "0783641925"
# you can do better than this with stri_rand_strings:
stri_rand_shuffle(rep(stri_paste(letters, collapse=''), 10))
#> [1] "hzurjxywmflgvnpitdcbqkosea" "qabxdrmfivjuokengzlcpsywth"
#> [3] "jrclqsfegpdvbymwzkinatuohx" "vdpmslbghwkyexqofrznijucta"
#> [5] "vfenrmxkjodwbyhiagpqstczul" "ryzknejxogavdlqfbuthmiswpc"
#> [7] "dhracixzobgewtvufjnlysqmpk" "tpfcjlximqohnyzuwrskbdaevg"
#> [9] "efhrunwcpgyajzsdtvbmqxliok" "xfekawtnbolgcpjizdrhmuyqsv"