Hi Rainer,

Thanks for the tip.

Your suggestion works perfectly, however as per the R Mantra of avoiding
for loops,  I propose the following this alternate:

# number of strings to be created
n <- 50

# random length of each string
v.length = sample( c( 2:4), n, rep = TRUE )

# letter sources
src.1 = LETTERS[ 1:10 ]
src.2 = LETTERS[ 11:20 ]
src.3 = "z"
src.4 = c( "1", "2" )

# turn into a list
src <- list( src.1, src.2, src.3, src.4 )

my.g = function(len,src)
{
  my.s = src[[ sample( 1:4, 1 ) ]]
  tmp = sample(my.s,len,rep=TRUE)
  n1 = paste(tmp,collapse="")
  n1
} # end

sapply(v.length,my.g,src)


// Cheers.

	[[alternative HTML version deleted]]


