Skip to main content
added 77 characters in body
Source Link
Kade
  • 7.9k
  • 24
  • 53

Python 2, 123 122 118 114114 98 Bytes

Man, I wish random wasn't so expensive (and that we didn't have to filter for spaces). Now we have big savings from being allowed to have cipher characters at the end :) Anyways, here ya go:

from random import*
f=lambda s,n:s and(' '<s[0])*(s[0]+eval(*eval('chr's[0]'+'+chr(randint(32,126))+'*n)[:-1])'*n)+f(s[1:],n)if s[1:]else s

Python 2, 123 122 118 114 Bytes

Man, I wish random wasn't so expensive (and that we didn't have to filter for spaces). Anyways, here ya go:

from random import*
f=lambda s,n:(' '<s[0])*(s[0]+eval(('chr(randint(32,126))+'*n)[:-1]))+f(s[1:],n)if s[1:]else s

Python 2, 123 122 118 114 98 Bytes

Man, I wish random wasn't so expensive (and that we didn't have to filter for spaces). Now we have big savings from being allowed to have cipher characters at the end :) Anyways, here ya go:

from random import*
f=lambda s,n:s and(' '<s[0])*eval('s[0]'+'+chr(randint(32,126))'*n)+f(s[1:],n)
deleted 2 characters in body
Source Link
Kade
  • 7.9k
  • 24
  • 53

Python 2, 123 122122 118 114 Bytes

Man, I wish random wasn't so expensive (and that we didn't have to filter for spaces). Anyways, here ya go:

from random import*
f=lambda s,n:s if len(s)<2else(' '<s[0])*(s[0]+`[chrs[0]+eval(('chr(randint(32,126))for x in[1]*n]`[2:+'*n)[:5]-1]))+f(s[1:],n)if s[1:]else s

Python 2, 123 122 Bytes

Man, I wish random wasn't so expensive (and that we didn't have to filter for spaces). Anyways, here ya go:

from random import*
f=lambda s,n:s if len(s)<2else(' '<s[0])*(s[0]+`[chr(randint(32,126))for x in[1]*n]`[2::5])+f(s[1:],n)

Python 2, 123 122 118 114 Bytes

Man, I wish random wasn't so expensive (and that we didn't have to filter for spaces). Anyways, here ya go:

from random import*
f=lambda s,n:(' '<s[0])*(s[0]+eval(('chr(randint(32,126))+'*n)[:-1]))+f(s[1:],n)if s[1:]else s
Source Link
Kade
  • 7.9k
  • 24
  • 53

Python 2, 123 122 Bytes

Man, I wish random wasn't so expensive (and that we didn't have to filter for spaces). Anyways, here ya go:

from random import*
f=lambda s,n:s if len(s)<2else(' '<s[0])*(s[0]+`[chr(randint(32,126))for x in[1]*n]`[2::5])+f(s[1:],n)