Revision: 4981
Initial Code
Initial URL
Initial Description
Initial Title
Initial Tags
Initial Language
at February 1, 2008 06:35 by imhugo
Initial Code
// ************************************************** // // Author: ImHugo // URL: http://www.imhugo.com // ************************************************** // // Vars var arrayToRandom:Array = new Array(); var qRequired:Number = 5; // Inserts Numbers in Array for(var i:Number = 1; i<=qRequired; i++) { arrayToRandom.push( i ); } // Outputs numbers non-repeated for(var k:Number = 1; k<=qRequired; k++) { // Search for value inside the Array in a random position var randomPos:Number = Math.floor( Math.random() * arrayToRandom.length ); // Selects value and removes it from Array var valueFromArray = arrayToRandom.splice(randomPos, 1); // Converts value in number var numberRand = parseInt(valueFromArray); trace(numberRand); }
Initial URL
Initial Description
Initial Title
Non-repeated random numbers
Initial Tags
actionscript
Initial Language
ActionScript