command line, eq cat test test test|shuf|head -n 18|grep -v ^$|paste -s -d"\0"
:
powershell $r=New-Object Random;1..3^|%{gc test}^|select -f 18^|%{[array]$A+=$_};1..$A.Count^|%{$A[$r.Next(0,$A.Count-1)]}^|?{$_.Length -ne 0}^|%{$S+=$_};$S
cat test test test
approximate correspondence ``1..3^|%{gc test}`
shuf
approximate correspondence (powershell shuffle strings in pipe):
$r=New-Object Random; ... %{[array]$A+=$_};1..$A.Count^|%{$A[$r.Next(0,$A.Count-1)]}
head -n 18
approximate correspondence select -f 18
grep -v ^$
approximate correspondence ?{$_.Length -ne 0}
paste -s -d"\0"
approximate correspondence %{$S+=$_};$S
when see command line:
cat test test test|shuf|head -n 18|grep -v ^$|paste -s -d"\0"
imagined the file type - test
:
1
2
3
5
7
8
use file test
:
apple
orange
cafe
11
22
33
shuffle1.ps1:
$r=New-Object Random;1..3|%{gc test}|select -f 18|%{[array]$A+=$_};1..$A.Count|%{$A[$r.Next(0,$A.Count-1)]}|?{$_.Length -ne 0}|%{$S+=$_};$S
For the purpose of generating text from templates are more suitable in another language.
It needs a specialist in Common Lisp and C. May be an expert Haskell.
If necessary mathematical symbolic computation then it is likely Maxima.
But you can always do whatever tools that are not designed for specific tasks ))).
It will be very nice if you describe your problem completely. Architecturally.
112233112233112233appleorangecafeappleorangecafeappleorangecafe
would be your longest combination from your example, right?