Sequencial Imagem loading to random loading

I’ve downloaded a free script that reads several JPG files and it makes a sequencial slideshow.

This is the function used:

ImageFader.prototype.loadXML = function (x) {
var _xml = new XML ();
_xml.ignoreWhite = true;
_xml.path = this;
_xml.load (x);
_xml.onLoad = function () {
for (var a = 0; a < this.firstChild.childNodes.length; a++) {
var _trans = this.firstChild.childNodes[a].attributes.TRANSITION;
var _pause = this.firstChild.attributes.PAUSE
var _img = this.firstChild.childNodes[a].firstChild.nodeValue;
this.path._dataProvider.push ({img:_img, transition:_trans, pause:_pause});
}
this.path.startFading ();
delete this;
};
};

My question is…
How to change that script to it loades random jpg from the xml in stead if loading img1, img2 from xml.

Anyone can help ? Thanks in advance