home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
ftp.ee.pdx.edu
/
2014.02.ftp.ee.pdx.edu.tar
/
ftp.ee.pdx.edu
/
pub
/
frp
/
util
/
name3
/
newnames.awk
< prev
next >
Wrap
Text File
|
1991-03-09
|
627b
|
43 lines
#! /usr/local/bin/nawk -f
BEGIN {
srand()
Count[0] = 0
Section = 0
}
/^%[ ]*$/ {
Section++;
Count[Section] = 0
next
}
/^#.*$/ { next } # ignore comments
/^[ ]*$/ { next } # ignore blank lines
{
Syllables[Section, Count[Section] ] = $0
Count[Section]++
}
END {
for (;;) {
# random from first section
printf "[%s", Syllables[0, Rand(0, Count[0] - 1)]
for (i = 1; i <= Section && i in Count; i++) {
if (Count[i]) {
printf "-%s", Syllables[i, Rand(0, Count[i] - 1)]
}
}
printf "]\n"
}
}
function Rand(min, max)
{
return int((max + 1 - min) * rand()) + min
}