2007年9月28日 @ 15:21
AS3 randRange() functionA
AS3 randRange() function
Recently I needed to generate a random number of items for a unit test in flex. In ColdFusion this is easy, I can use the randRange(x,x) function. However, there is not a randrange() function built into AS3.So with a little help from google, here is a simple AS3 randRange() you can use.
[Update: Thanks to Till & Keith, here is an updated function]
{
return Math.floor(start +(Math.random() * (end - start)));
}
Filed under: 资料 · Tags: function as3
Articles related:
Putting functions inside objects at runtime (2007-9-26 16:52:10)
List of 22 ActionScript 3.0 API's (2007-9-13 11:52:55)
Cube Wallpaper - AS3 and Flex API Posters (2007-8-14 16:24:51)
Quick Tips for Making ActionScript 3 Components (2007-8-14 15:59:47)
ActionScript 3 Cookbook 中文版 (2007-8-9 8:45:6)
ActionScript 3 Cookbook 中文版 第四章.数字和数学 (2007-8-9 8:21:36)
ActionScript 3 Cookbook 中文版 第三章. 运行时环境 (2007-8-9 8:20:53)
ActionScript 3 Cookbook 中文版 第二章. 自定义类 (2007-8-9 8:20:8)
ActionScript 3 Cookbook 中文版 第一章. ActionScript 语言基础 (2007-8-9 8:19:26)
ActionScript 3 Cookbook 中文版 第五章.数组 (2007-8-9 8:18:19)
Leave a Comment
◎welcome to give out your point。
