Показать сообщение отдельно
Старый 21.11.2008, 14:59
Fernando Costa вне форума Посмотреть профиль Отправить личное сообщение для Fernando Costa Найти все сообщения от Fernando Costa
  № 5  
Ответить с цитированием
Fernando Costa
 
Аватар для Fernando Costa

Регистрация: Oct 2006
Адрес: simferopol -> kyiv
Сообщений: 2,161
Отправить сообщение для Fernando Costa с помощью ICQ
вот вам вариант без массива(генерация псевдослучайной последовательности):

Код AS3:
package  {
	/**
	 * ...
	 * @author Anton Bodrichenko
	 * @usage  
	 * 			Utils.numRandomSeed = Math.floor(Math.random()*200);
	 *			trace(Utils.getRandomValue(52));
	 *			trace(Utils.getRandomValue(52));
	 *			trace(Utils.getRandomValue(52));
	 * 
	 */
	public class Utils 
	{
		private static const A:int = 3423313;
		private static const C:int = 2435;
		//private static var numSeedCnt:int = 0;
		public static var numRandomSeed:int;
 
		public function Utils() 
		{
 
		}
		public static function getRandomValue($maxvalue:int):int {
			numRandomSeed = (numRandomSeed*A)%2147352576;
			var result:int = (Math.floor((numRandomSeed*$maxvalue)/C))%$maxvalue;
			return (result);
		}
	}
 
}
__________________
: M F N W :