mp64: generate total random words
#20
how can i create words with random lenght from 8-15 ?
like:
dfh43/T&DW
&TGdwszgdw
7gf/R3g(%
43rz3)/3z7
"$(hr3h9/§"R/zz


with fold -w8 or fold -b8 its only possible to generate 8-lenght words..


(05-05-2012, 01:17 AM)M@LIK Wrote: After more than a week of researches : P...
I believe I found the best way to do this.
Unique, pure, random words xD
All in one liner (Only for Linux) (On Windows you can use Cygwin):
Code:
cat /dev/urandom | tr -cd '[charset]' | head -c[size_of_output_in_bytes] | fold -w[string_length] | sort -u | awk "length==[string_length]"
(awk is used only to verfiy the length [optional])
(sort -u is not necessary too, you would rarely find dupes [optional])

charset = is the desired character-set:
Code:
a-z = ?l
A-Z = ?u
0-9 = ?d
\ -~ = ?s

size_of_output_in_bytes = is the maximum output size:
Code:
1024=1024 (1 kilobyte)
1024^2=1048576 (1 megabyte)
1024^3=1073741824 (1 gigabyte)
Note: size might increase due to line endings (fold).

string_length = is the desired length.


Examples:
Code:
cat /dev/urandom | tr -cd 'a-z' | head -c1048576 | fold -w8 | sort -u | awk "length==8"
This outputs 1 megabyte of 8-length words (All in lower-case).
Code:
...
dnwvbzdh
wkgnhnub
iigbbpjd
pmjnrbaw
iqfltfrm
liaakmnb
pimrhdlo
shgtkwnx
rmizhqzt
ojhukfdl
fxcsznbi
...


Code:
cat /dev/urandom | tr -cd 'a-zA-Z0-9' | head -c2048 | fold -w15 | sort -u | awk "length==15"
This outputs 2 kilobyte of 15-length words (All ?u?l?d) (very nasty xD).
Code:
...
FMQdpOPW4kUDJ8X
GfbFV093R76ksvU
GSXYlvhcHZ1zMhW
I5wdEUeAtipBSD3
i9CwDdmcPkj755t
Ic6XEEhnJKEWu9Q
IR0H8mfsliFBsRq
IzutBcjruiDspa7
J7knLbBd7QV6rdg
jfNY2c6k5i93x0p
KvK6eAWxAmSw4UD
kwqcNvpIh1KIqgt
kWvH1ZP9zp9l0wE
lFM1rCh545M88fC
...


Let's go HARDCORE!
Code:
cat /dev/urandom | tr -cd 'a-zA-Z0-9\ -~' | head -c2048 | fold -w32 | sort -u | awk "length==32"
Code:
...
-<%2p?e6E<~?Ov7M=B*hR(1-@GZO:lxn
1lP 4<^7+s-@ 60M\SfG1=2HO^mJGF;,
1N mi4XHk+/r0%8XaI7UdC$L`bi: "-G
1NACv-cdB5&ONn>/A/Gm_x+^Wdm',?tp
2!*8_>&-Ik6|\ae+kLy;RG?&>~*@Gz(0
2LnsHQ ?TTaZxj@+UB"AHCw #qIbKqid
6???[1i}vI#CrOuxY0ehK2.297]N6gh+
7w|{a0gYX;Q>sm#g@{Z! >rs>lUo$LkO
7wiH` ,8KOkeshfYv7;^Z~u(ed4PfQ&E
9q(%^2MA$JS05A9.,e-mQJ2B[E~5#|af
AE/QEyy0@I'oN.V&{a?:6*{l@;phcY^s
AF[8*%i?InMU7d,_Gf@'Lo{OD=?{|u&k
...

LOL

I must say, I'm loving the rubbish this is giving me. xD
Reply


Messages In This Thread
mp64: generate total random words - by M@LIK - 04-22-2012, 05:36 PM
RE: mp64: generate total random words - by atom - 04-23-2012, 10:20 AM
RE: mp64: generate total random words - by M@LIK - 04-23-2012, 11:38 AM
RE: mp64: generate total random words - by M@LIK - 04-23-2012, 12:28 PM
RE: mp64: generate total random words - by atom - 04-23-2012, 12:49 PM
RE: mp64: generate total random words - by M@LIK - 04-23-2012, 01:01 PM
RE: mp64: generate total random words - by M@LIK - 05-05-2012, 01:17 AM
RE: mp64: generate total random words - by ckz666 - 10-14-2012, 12:25 PM
RE: mp64: generate total random words - by atom - 05-06-2012, 03:49 PM
RE: mp64: generate total random words - by M@LIK - 05-06-2012, 04:04 PM
RE: mp64: generate total random words - by M@LIK - 05-20-2012, 01:34 PM
RE: mp64: generate total random words - by atom - 05-21-2012, 05:55 PM
RE: mp64: generate total random words - by M@LIK - 05-21-2012, 05:59 PM