Created
May 23, 2014 01:23
-
-
Save dofy/9649d76793b7102331a1 to your computer and use it in GitHub Desktop.
1-50 随机顺序
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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