Skip to content

Instantly share code, notes, and snippets.

@dofy
Created May 23, 2014 01:23
Show Gist options
  • Save dofy/9649d76793b7102331a1 to your computer and use it in GitHub Desktop.
Save dofy/9649d76793b7102331a1 to your computer and use it in GitHub Desktop.
1-50 随机顺序
package
{
public class NumberRandomSort
{
public function NumberRandomSort()
{
var a:Array = [];
for (var i:int = 0; i < 50; i++)
{
// 随机 index 插入数组
var ind:int = Math.round(Math.random() * a.length);
a.splice(ind, 0, i + 1);
}
trace(a);
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment