![]() |
|
||||||||||
|
|||||
|
Регистрация: Jul 2002
Сообщений: 16
|
Как получить случайное число:
1) на промежутке (например от 1 до 100). 2) или из группы разных чисел (не попорядку и нет прогрессии и закономерностей (например 2, 188, 5, 34, 1000). |
|
|||||
|
Math.random
array[Math.random]
__________________
Two beer or not two beer?... |
|
|||||
|
Регистрация: Jul 2002
Сообщений: 16
|
что-то не пойму. Например переменной x надо присвоить случайное число от 1 до 100 как скрипт выглядет?
|
|
|||||
|
F1:
------------------------------------------------------------------------------ Math.random Syntax Math.random(); Arguments None. Description Method; returns a pseudo-random number between 0.0 and 1.0. Player Flash 5 or later. In the Flash 4 Player, the methods and properties of the Math object are emulated using approximations and may not be as accurate as the non-emulated math functions supported by the Flash 5 Player. See also random ------------------------------------------------------------ random Syntax random(); Arguments value The highest integer for which random will return a value. Description Function; returns a random integer between 0 and the integer specified in the value argument. Player Flash 4. This function is deprecated in Flash 5; use of the Math.random method is recommended. Example The following use of random returns a value of 0, 1, 2, 3, or 4: random(5); See also Math.random -------------------------------- x = 1+random(100); x = 1+int(Math.random()*100); x = 1+Math.floor(Math.random()*100);
__________________
Two beer or not two beer?... Последний раз редактировалось SPV; 14.02.2003 в 12:24. |
|
|||||
|
Math.random()
Method; returns n, where 0 <= n < 1. || Flash Player 4. This function is deprecated in Flash 5; use of the Math.random method is recommended. Usage random(value) Example The following use of random returns a value of 0, 1, 2, 3, or 4: random(5);
__________________
Старый плюс лучше новых двух. I like RTFM попросил - подожди - обработай Chr(255) == '\xFF' - это про "я" lexass |
![]() |
Часовой пояс GMT +4, время: 00:26. |
|
|
« Предыдущая тема | Следующая тема » |
|
|