//*** This code is copyright 2004 by Gavin Kistner, !@phrogz.net //*** It is covered under the license viewable at http://phrogz.net/JS/_ReuseLicense.txt //*** Reuse or modification is free provided you abide by the terms of that license. //*** (Including the first two lines above in your source code satisfies the conditions.) // Returns n randomly-chosen items from an array, without dupliates // var words = ['hello','goodbye','zounds!','zoinks!']; // var twoWords = words.randomItems(2); Array.prototype.randomItems=function( itemCount ){ for (var i=0,all=[];ia?1:0 } ); for (var i=0,items=[];i