randomize timer()
sync on:sync rate 0
 
global name$=""
 
`make letter arrays
dim consonants$(54)
dim vowels$(41)
 
`fill arrays with data
restore consonants
for i=0 to 54
   read consonants$(i)
next i
restore vowels
for i=0 to 41
   read vowels$(i)
next i
 
`generate 100 random names
if file exist("names.txt") then delete file "names.txt"
open to write 1,"names.txt"
for i=1 to 100
   name$=Generate_Name()
   print name$
   write string 1,name$
   sync
   wait key
next i
close file 1
 
wait key
 
`function
function Generate_Name()
 
   local letter=0
   local namevar$=""
   local length=0
   length=rnd(3)+4
 
   dim letters$(length)
 
   for i=1 to length
      letter=1-letter
      if letter=1 then letters$(i)=consonants$(rnd(54))
      if letter=0 then letters$(i)=vowels$(rnd(41))
      if letters$(i)="q" and i<length then inc i:letters$(i)="u"
   next i
 
   for i=1 to length
      namevar$=namevar$+letters$(i)
   next i
 
   undim letters$(0)
 
endfunction namevar$
 
`data
consonants:
data "b","b","c","c","d","d","d","d","f","f","g","g","g"
data "h","h","j","k","l","l","l","l","m","m"
data "n","n","n","n","n","n","p","p","q","r","r","r","r","r","r"
data "s","s","s","s","t","t","t","t","t","t","v","v","w","w","x","y","z"
 
vowels:
data "a","a","a","a","a","a","a","a","a"
data "e","e","e","e","e","e","e","e","e","e","e","e"
data "i","i","i","i","i","i","i","i","i"
data "o","o","o","o","o","o","o","o"
data "u","u","u","u"