📜 ⬆️ ⬇️

Cambridge University Effect

Shuffle letters. The effect of the University of Cambridge.


According to rzelulattas are ilseadonal odongo unlegisokgo univertiset, they do not have a date, in which cocoa cake there are salvaged bouquats in salt. Gavvone, chotbay preavaya and plopendyaya bkvuy blyi on mset. Osatlyne bokva mgout seldovti in ploonm bsepordyak, all-torn tkest chtaitsey without browning. The pichrion egoto is the fact that we cite not with each other on a separate basis, but everything is solicitous.
The topic is very old and has been browsing the Internet for a long time, but everywhere the same text is given as an example, I was interested to try this effect on my own texts, as a result of which this program was born.

Example of the program:


You can download or enter text manually, shuffle and save. The source code is attached, if there are comments on the optimization of mixing I will be glad to hear.

So far I have noticed that a text with scientific terms, for example from Wikipedia, is harder to read artistic, which, incidentally, is logical, the most frequently used words are recognized immediately without effort.
')
Source code is quite a bit, the text conversion function:
string eng_rus_alphavit = "AaBbCcDdEeFfGgHhIiJjKkLlMmNnOoPpQqRrSsTtUuVvWwXxYyZz"; Random rnd = new Random((int)DateTime.Now.Ticks); /// <summary> ///           /// </summary> public string RndSym(string word) { if (word.Length > 2) { string ret = ""; //         int[] index = new int[word.Length]; for (int i = 0; i < word.Length; i++) index[i] = -1; index[0] = 0; index[word.Length - 1] = word.Length - 1; int v = rnd.Next(1, word.Length - 1); for (int i = 1; i < word.Length - 1; i++) { while (index[v] != -1) v = rnd.Next(1, word.Length - 1); index[v] = i; } //     for (int i = 0; i < word.Length; i++) { ret += word[index[i]]; } return ret; } return word; } /// <summary> ///   /// </summary> private string TransformText(string text) { int begin; string nword; char[] array = text.ToCharArray(); for (int i = 0; i < array.Length; i++) { if (eng_rus_alphavit.Contains(array[i].ToString())) { begin = i; while (eng_rus_alphavit.Contains(array[i].ToString()) && (++i < array.Length)) ; nword = RndSym(text.Substring(begin, i - begin)); //     for (int j = begin; j < i; j++) { array[j] = nword[j - begin]; } } } string ret = ""; foreach (char c in array) ret += c; return ret; } 


The release (Win x86 / x64) and source codes (C #, VS2010) can be downloaded here .

The program does not carry any practical benefits, except to pump up reading skills and load the brain.

Source: https://habr.com/ru/post/122163/


All Articles