Given a string containing only letters (case-insensitive), split it into words of uniformly random lengths, using the distribution below, with the exception of the last word, which can be of any valid length (1-10). Your output is these words, as a space-separated string ("test te tests"
), an array of strings (["test","te","tests"]
), or any other similar output format.
Word Length Distribution
Word Length - Fractional Chance / 72 - Rounded Percentage
1 - 2 / 72 - 2.78%
2 - 14 / 72 - 19.44%
3 - 16 / 72 - 22.22%
4 - 12 / 72 - 16.67%
5 - 8 / 72 - 11.11%
6 - 6 / 72 - 8.33%
7 - 5 / 72 - 6.94%
8 - 4 / 72 - 5.56%
9 - 3 / 72 - 4.17%
10 - 2 / 72 - 2.78%
Your odds do not need to match exactly - they can be off by 1/144
th, or .69%
, in either direction (but obviously they still must sum up to 72/72
or 100%
).
Data roughly guessed from the fourth page, first figure of this paper.
Test Cases with Sample Output
Behavior on very short (length < 11) test cases is undefined.
Note that I created these by hand, so they may or may not follow the uniform distribution above.
abcdefghijklmnopqrstuvwxyz
abcd efgh i jklmnopq rs tu vwx yz
thequickbrownfoxjumpedoverthelazydog
t heq uick brown fo xj ump edo vert helazydog
ascuyoiuawerknbadhcviuahsiduferbfalskdjhvlkcjhaiusdyfajsefbksdbfkalsjcuyasjehflkjhfalksdblhsgdfasudyfekjfalksdjfhlkasefyuiaydskfjashdflkasdhfksd
asc uyoi uawer k nb a dhcviua hsid ufe r bfa lskd jhv lkcj haius dy faj se fbks dbfkals jcuyasjehf lkjh falk sd blhsgdf asudyfekjf alk sdjfhlk asefyu iaydskfja shdflk as dhf ksd
This is code-golf, so shortest answer in bytes wins.