From letters to words?

I have a little function here from one of my books that generates a random cycle of letters based on a string, is it possible to have this working with multiple words instead of individual letters?


// create string to randomly select characters from
str="t";
// create controller mc
this.createEmptyMovieClip("mc",1);
mc.c=10;
mc.onEnterFrame=function(){
	// attach new instance every frame.
	this._parent.attachMovie("particle","p"+this.c,this.c);
	// set initial values for new instance in onLoad
	this._parent["p"+this.c].onLoad = function(){
		this.wl=50+50*Math.random(); // wavelength for sine
		this.ampl=0; // amplitude for sine
		this.as=2*Math.random(); // speed for aplitude change
		this.sp=2+2*Math.random(); // speed for upward motion
		this.bx=_root._xmouse; // set base x coord to mouse pointer position
		this._y=_root._ymouse; // set base y coord to mouse pointer position
		this._x=this.bx;
		this.txt=str.substr(Math.floor(_root.str.length*Math.random()),1);
	}
	// fire off the onLoad function
	this._parent["p"+this.c].onLoad();
	// onEnterFrame function for new instance
	this._parent["p"+this.c].onEnterFrame=function(){
		// calculate new coords
		this._x=this.bx+(this.ampl*Math.sin((this._y)/this.wl));
		this._y-=this.sp;
		// increase amplitude of wave to make the smoke spread out
		this.ampl+=this.as;
	}
	// increase counter for levels
	this.c++;
}
stop();