Please advise,
 
What is this piece of code doing:
 
for (posArray = [], i = 0; i < this.length; posArray[i] = i++) {}
 
I though it might have been another way of coding:
 
for (i=0; i<this.length; i++) {    posArray[i] = i;}
But what would be the point of that anyway ?
I have never seen a FOR loop like the above one until now.
Here is the complete slab of code that it comes from (see line 3):
 
Array.prototype.fullShuffle = function() { result = []; for (posArray = [], i = 
0; i < this.length; posArray[i] = i++) {} for (last = this.length - 1; last >= 
0; last--)  {  selected = this[last];    rand = random(posArray.length - 1);    
lastPos = posArray.getPos(last);    if (lastPos == null) {   
result[posArray[rand]] = selected;   posArray.splice(rand, 1);  } else {   
posArray.splice(lastPos, 1);   result[posArray[rand]] = selected;   
posArray.splice(rand, 1);   posArray.push(last);  } }
  return result;}
 
 
Thanks,
Stephen._______________________________________________
[email protected]
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com

Reply via email to