Generate a cipher given a number and string
Your task is simple. Given a string s and a number 0 <= n <= 9 as inputs, insert a pseudo-random printable ASCII character between each character of the string n times. Such that for each character of s there are n random characters between them. Spaces should be trimmed.
Input:
- string
sphrase to encrypt in the cipher - integer
nin the range of0 <= n <= 9
Example:
Input:
The treasure is here
2
Output:
T!0h32eF4t0irlkehma7ys#0u*&r*he!2iH^sB,h!@e0)r$he
This is code-golf so the shortest code wins! Good Luck and have fun!
nunique random ascii characters between the letters (no duplicate random characters between the letters)? – Emigna 4 hours agoncharacters consists ofncopies of the same random character, they are still random, but they are not statistically independent. And so on – Luis Mendo 2 hours agoOare more likely than spaces or~? If it has to be uniform, then you should say so explicitly. And if it doesn't have to be uniform, then you should at least state something like each character needs to have a non-zero probability. You've also stated in a previous comment that each character does have to have an independent distribution, so if this is important, it should be mentioned in the challenge. There is a very broad spectrum of randomness. – Martin Ender♦ 2 hours ago