Created
January 10, 2013 12:32
-
-
Save Tomyail/4501749 to your computer and use it in GitHub Desktop.
(i%3+3)%3 i是任意整型,3是数组长度,得到的结果都是一个对于该数组合法的索引
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
public function getLegalIndexFromArray(index,arrayLength):int | |
{ | |
return (index%arrayLength+arrayLength)%arrayLength; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment