I’ve posted some Swift code on github for generating nonsense words. The function patternedNonsense()
generates pronounceable words like
1: hira-zansa
2: siqe-ratse
3: sifo-dassa
4: tixi-furse
The second, pureNonsense9()
generates words like
1: gjoh-xkcri
2: xxgg-jjqfh
3: mxsv-tngwh
4: ftkm-aakif
Both functions use an extension to the String class that works like this
let alphabet = "abcdefghijklmnopqrstuvwxyz"
let digits = "0123456789"
alphabet.randString(4) + digits.randString(4)
// "njtu4428"
The first function makes use of diagrams, e.g.,
dgvc = ['in', 'er', 'an', 'at', 'on', 'es', 'en', 'ed', 'it', 'is',
'or', 'as', 'et', 'of', 'al', 'ar', 'ur']
dgcv = ['he', 're', 'ha', 'to', 'hi', 'ti', 'te', 'de', 'se', 'se',
'sa', 'si', 've', 'ra']
as well as a generic function randElement
which returns a
random element of an array.