Skip to content

Instantly share code, notes, and snippets.

@abikoushi
Created June 9, 2022 23:58
Show Gist options
  • Save abikoushi/78b8ca35e637021c0d936860270c0922 to your computer and use it in GitHub Desktop.
Save abikoushi/78b8ca35e637021c0d936860270c0922 to your computer and use it in GitHub Desktop.
Japanese traditional cryptogram
tanuki <- function(x,n){
letter <- "た"
len <- nchar(x)
p <- sort(sample(2:len,n))
sv <- character(n+1)
sv[1] <-substr(x,1,p[1])
for(i in 1:(n-1)){
sv[i+1] <- substr(x,p[i]+1L,p[i+1])
}
sv[n+1L] <- substr(x,p[n]+1L,len)
paste(sv, collapse = letter)
}
x <- "お疲れ様です。お忙しい中ご対応誠にありがとうございます。資料を拝見し、CVの増加など良い結果が得られていると感じます。ミーティングについては、13日(来週月曜日)15時以降はいかがでしょうか。"
tanuki(x,40)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment